Anthanh PRO
I ♥ the web, technologies and....beers! Co-founder of https://etereo.io
El lado OSCURO
(function( window, undefined ) {
...
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
...
jQuery.fn = jQuery.prototype = { ... };
...
window.jQuery = window.$ = jQuery;
...
})( window );
break, case, catch, continue, debugger, default, delete,do, else, false, finally, for, function, if, in, instanceof, new, null, return, switch, this, throw, true, try, typeof, var, void, while, with.
para el futuro:
abstract, boolean, byte, char, class, const, double, enum, export, extends, final, float, goto, implements, import, int, interface, let, long, native, package, private, protected, public, short, static, super, synchronized, throws, transient, volatile, yield.
para el navegador:
alert, blur, closed, document, focus, frames, history, innerHeight, innerWidth, length, location, navigator, open, outerHeight, outerWidth, parent, screen, screenX, screenY, statusbar, window.
var method; //ok
var class; //illegal
object = {box: value}; //ok
object = {case: value}; //illegal
object = {'case': value}; //ok
object.box = value; //ok
object.case = value; //illegal
object.['case'] = value; //ok
function echoArgs() {
console.log(arguments); // [object Arguments]
console.log(arguments[0]); // 1
console.log(arguments.slice(0, 1)); // Error!
}
echoArgs(1, 2, 3, 4);
function echoArgs() {
var slice = Array.prototype.slice;
return slice.call(arguments, 0, 1);
}
echoArgs(1, 2, 3, 4); //1
eval('console.log("' + key + '")')
Inseguro, difícil de leer
return;
{
status: true
};
return {
status: true
};
var array = [
'one',
'two',
'three', // IE error!
];
var array = [
'one',
'two',
'three'
];
parseInt('10'); // 10
parseInt('10 cows'); // 10
parseInt('cows 10'); // NaN
parseInt('09/20013'); // 0!
parseInt('08/20013'); // 0!
parseInt('10', 10);
parseInt('10 cows', 10);
parseInt('cows 10', 10);
parseInt('09/20013', 10);
parseInt('08/20013', 10);
var numbers = [
'one',
'two',
'three',
'four',
'five'
];
delete numbers[2];
numbers.length; // 5!
typeof null // object!!!
NaN === NaN // false
NaN !== NaN // true
0
NaN
''
false
null
undefined
{} // nunca!
0 == '0' // true
0 == '' // true
'' == '0' // false
false == 'false' // false
false == 0 // true
false == undefined // false
false == null // false
null == undefined // true
' \t\r\n' == 0 // true
0.1 + 0.2
(0.1*100 + 0.2*100)/100
By Anthanh
Historias del inframundo relacionadas con el lenguaje JavaScript
I ♥ the web, technologies and....beers! Co-founder of https://etereo.io