Created
June 19, 2020 18:57
-
-
Save ruddha2001/060412c568dd7f56e4710da873b881ab to your computer and use it in GitHub Desktop.
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
// Declaring a variable adventure, which has a type of string array | |
const adventure: Array<string> = [ | |
"India", | |
"USA", | |
"Canada", | |
"Japan", | |
"South Africa", | |
]; | |
/** | |
* A function to print a random country name from the adventure array | |
*/ | |
const randomAdventureGenerator = () => { | |
let randomNumber = Math.floor(Math.random() * 5); // Returns a random number from 0 to 4 | |
console.log(`Your next new adventure will be in ${adventure[randomNumber]}`); | |
}; | |
randomAdventureGenerator(); // Calling the randomAdventureGenerator function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment