![]() The syntax for prototypal inheritance also tends to be very cryptic and unusual. You can't inherit from Array or other builtin objects.In reality values do not fit into a neat hierarchy. JavaScript puts the world into a neat prototype hierarchy with Object at the top. ![]() The var statement uses function scope rather than block scope, which is a completely unintuitive behavior.This also takes place when sorting an array: The automatic type conversion of the + function also leads to the intuitive effect that += 1 is different than the ++ operator.This creates very counterintuitive effects if you accidentally convert a number to a string: Automatic type conversion between strings and numbers, combined with '+' overloaded to mean concatenation and addition.Every script is executed in a single global namespace that is accessible in browsers with the window object.Note some of this is not JavaScript itself, but web APIs ( ) 3.1 Fixed in currently supported versions.
0 Comments
Leave a Reply. |