7 JS Basic Knowledge Summary

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.