CybArt's public fiddles
-
myh6e1hc
No-Library (pure JS), HTML, CSS, JavaScript
-
wn7zjoco
No-Library (pure JS), HTML, CSS, JavaScript
-
hx33b7Lv
No-Library (pure JS), HTML, CSS, JavaScript
-
h2anjsas
No-Library (pure JS), HTML, CSS, JavaScript
-
The proper way to get a random number
Math.random() has a chance to return 0. If we use Math.ceil(0) we may still get 0, so the proper way is Math.floor() + 1 Credit: David McFarland
-
Self-called anonymous function
This structure pattern is often used in JavaScript libraries.
-
Splice method of Array
Obvious
-
Split method of Array
Clear from the code
-
Join method of the Array
Clear from the code
-
Slice method of Array object
Obvious
-
Concatenate arrays
All is clear from the code
-
Fun with Array sorting
Note that array by default is sorted in string-like fashion, and sort() requires a function to sort in numerc order. Note the reverse() and the clever use of Math.random() - 0.5 to make the floating point number either negative or positive.
-
Return operator in the function
Pretty simple.
-
The best way to loop through an array
As per Nicholas Zakas
-
A messy solution to Treahouse's FizzBuzz challenge
No-Library (pure JS), HTML, CSS, JavaScript
-
A better explanation of the while loop
Here the while loop is broken down into a readable format. Since any values other than 0, undefined, null, or empty string evaluate to true, in this case the loop will run until counter equals 0 and evaluates to false.
-
Primitive values in vars are independent, reference values refer to teh same object
No-Library (pure JS), HTML, CSS, JavaScript
-
Adding property to a reference value
When you work with a reference values, you can add, change, or delete properties and methods at any time. Primitive values cannot have properties or methods added to the,.
-
Function that doesn't have a return statementm returns undefined
No-Library (pure JS), HTML, CSS, JavaScript
-
If two functions are names the same, only the latest will work
No-Library (pure JS), HTML, CSS, JavaScript