This article mainly introduced 7 JS basic knowledge, the need of friends can refer to the next
1. How do I add a property to an object? Method One: var b = {}; b["Name" = "Test"; Delete B.name property methods for deleting objects two: B.name = "Test"; 2. How can I tell if a variable is declared? typeof (a) = = "undefined" typeof (d) = = = "Function" is 3. How do I represent a string? With double quotes (""), a single number (""), a backslash (//) 1+ "1" =11 1+ ' 1 ' =11 4.Javascript has only one numeric type, that is number. The basic data type of 5.Javascript? Number (numbers), string (String), Boolean (Boolean), undefined (undefined), null (empty), Other: Object (object) 6. What is the difference between a class and an object? How do I implement it with JavaScript? The code is as follows: function MyClass () {} MyClass.prototype.ID = 1; MyClass.prototype.Name = "Johnson"; MyClass.prototype.showMessage = function () {alert ("ID:" + this.id + "Name:" + this.) Name); var obj1 = new MyClass (); Obj1.showmessage (); 7. How many different kinds of loops are there in JavaScript? Two kinds. For loop and while loop.