Created
January 10, 2022 11:48
-
-
Save imbdb/42a7eb9006b760357557fe4dfe5ab999 to your computer and use it in GitHub Desktop.
Function to redirect page based on condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function redirect(sentence){ | |
if(sentence.contains('airport'){ | |
window.location('/airport') | |
} | |
else{ | |
window.location('/home') | |
} | |
} | |
// Test function | |
// redirect('goto airport') | |
// redirect('goto home') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment