====== JavaScript: Best practices ======
console.log('%c Test', 'color:orange');
console.log({var1, var2, var3});
console.table([var1, var2, var3]);
console.time('timerName');
... code ...
console.timeEnd('timerName');
console.trace('comment');
var a = varb + ' pero ' + varc; // Bad
var a = '${varb} pero ${varc}'; // Good
function test({prop1, prop2 prop3}) {
return '${prop1}, ${prop2}, ${prop3}';
}
//or
function test(array) {
const {prop1, prop2 prop3} = array;
return '${prop1}, ${prop2}, ${prop3}';
}
//usage
test(array); //array with field names as above
const var1 = var2 > 5 ? 'text1' : 'text2';
test = ['d','e','f'];
//push
test = [...test,'g','h','i'];
//shift
test = ['a','b','c',...test];
//insert
test = ['1','2',...test,'3','4'];
const high = array.filter(v => v > 100);
const tax = array.map(v => v * 1.25);