CSE 134B Lecture Notes - Lecture 4: Html Attribute, Eval
Document Summary
Ex: var x = 5 ; x = 100; For variables that do not exist anywhere , the interpreter creates it in the global space. Note: cannot execute functions called in the global space that are not declared in the global space! with syntax simplifies code and makes it easier to read (instead of obj. a, do with(objc) {a = blah} Js interpreter executes code immediately and prevents optimization. Hoisting - moves function definitions up to the top (by the 2 pass interpreter) Iife - immediately invoked function expression (function() { }) (); immediately executes the declared function. 5 primitive data types: boolean, undefined ( uninitialized , not undeclared, number, null, string. Primitives can be objects if defined with the new keyword. Can have methods fullname: function() { return this. firstname + + this. lastname; } person. fullname(); Object that owns (or execute) the js code. The value of this , when used in an object, is the object itself!