A Pen by Johan Kohlin on CodePen.
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
"a " + "ha" // "a ha" | |
"F" + "1" // "F1" | |
"F" + 1 // "F1" automatic type conversion | |
"2" + "1" // "21" | |
"2" + 1 // "21" automatic type conversion |
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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
This script contains ES6 specific generator functions. Use es6-shim.js | |
The following code is an adaptation of the original code created | |
by @jbum | https://krazydad.com/tutorials/makecolors.php | |
It is ok to include this script in your labs to | |
generate new colors for iterative purposes. | |
> nextColor() returns a css color string | |
* * * * * * * * * * * * * * * * * * */ | |
function nextColor() { |
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 random(min, max) { | |
/* defaults to: 1-10 */ | |
min = isNaN(+min) ? 1 : +min | |
max = isNaN(+max) ? 10 : +max | |
return Math.floor(Math.random() * (max-min+1)+min) | |
} | |
/* | |
examples: | |
random(1,80) -> 1-80 | |
random() -> 1-10 (using the defaults) |