The 2 parts of this if/else statement work separately but not when put together. Any ideas on how to make it work? I want the user to click a button that allows them to not enter the website and if they came from a different page it will take them there, otherwise if they didn't come from a different page it will take them to Udemy. Thx
function goBack (){
if (window.history.go(-1)){
window.history.go(-1)
}
else {
window.location.href="https://www.udemy.com/"
}
}