Created
April 27, 2014 04:51
-
-
Save jakeboxer/11337845 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
// Random | |
var numberToAdd = Math.floor(Math.random() * 50); | |
var array = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]; | |
if (array.indexOf(numberToAdd) >= 0) { | |
console.log(numberToAdd + " is already in the array, ignoring..."); | |
} else { | |
console.log(numberToAdd + " isn't in the array, adding...") | |
array.push(numberToAdd); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment