JSFiddle - React, Tailwind, and code Playground
by jmcjc5u
JavaScript
// reference: https://stackoverflow.com/questions/5630123/javascript-string-integer-comparisons
//alert (isNaN ('12'));
alert ('2' > '10') // string comparison: '2' >'1'
alert ('2'/1 > '10'/1) // number comparison: 2 < 10
//var x = 1;
// alert ( 2*x );
//document.write ( 2*x + '<br>' + (2*x+1) );
//document.write ( '<p>' + 2*x + '</p>');
//document.write ( '<p>' + (2*x + 1) + '</p>');
//console.log (2*x)
// === vs. ==
// number 1 (and string '1') is considererd true
// all else is false
var xx = '1';
/*
if (xx == true) {
alert ('xx is true');
} else {
alert ('xx is false');
}
var a = 10;
var b = 1.1;
alert (a % b);
( function( ) {
Math.clamp = function(val,min,max) {
return Math.min(Math.max(val,min),max);
}
} )();
alert (Math.clamp(1.3, -1, 1))
*/