js oneliners
by kontrach
HTML
One liners. Questions for JS.
Please, open the console.
JavaScript
const operations = [
2 + true,
'6' + 9,
4 + 3 + 2 + '1',
-'34' + 10,
+'dude',
-5 % 2,
null == undefined,
null === undefined
];
console.log(...operations);
var y = 1, x = y = typeof x;
console.log( 'y = 1, x = y = typeof x; : ', x );
var a = (2,3,4)
console.log( '(2,3,4) : ', a );
var b = (1, 5 - 1) * 2;
console.log('(1, 5 - 1) * 2 : ', b);
var c = !'bang';
console.log("!'bang' : ", c);
var d = parseFloat('12.4.2');
console.log('parseFloat("12.4.2") : ', d);
console.log(
'Math.max([2,3,4,5]) : ',
Math.max([2,3,4,5]),
Math.max(2,3,4,5),
Math.max.apply([2,3,4,5]),
Math.max.apply(Math, [2,3,4,5])
);
console.log('3 instanceof Number : ', 3 instanceof Number, (3) instanceof Number);