Dabbler Rookie Learn Web Development 2--javascript Study 1

Source: Internet
Author: User

JavaScript is a Class C language, and it's pretty easy for me to learn.

1 output

Console.log (* *); Equivalent to print

Console.assert (*); popup 2 variable JS is a dynamic variable similar to Python but to precede with var such as var a = 3 or 3.0 or ' name ' and so on if not add Var to the global variable is not recommended so use 3 comparison operator with ' = = ', ' = = ' Converts a variable type 4 object similar to a struct add property a.attr = *; Delete the attribute delete a.attr Delete the property called ' * * ' delete a[' * * '] 5 array operation slice: Intercept array

arr.slice(0, 3); // 从索引0开始,到索引3结束,但不包括索引3

arr.slice(3); // 从索引3开始到结束

Push and pop: add a delete element at the end of the array

Ubshift and shift: adding elements to the head of an array

Sort: Sorting

Reverse: Reverse

Splice: A common method for modifying arrays.

arr.splice(2, 3, ‘Google‘, ‘Facebook‘); 从索引2开始删除3个元素,然后再添加两个元素:

Concat: Chain join: Concatenate each element of an array with a specified symbol 6 string case: toUpperCase () and TOLOWERCASW () split: substring (1,5) Link: ' + ' or ' ***${key1}${' Key2} ' Note the quotation mark 7 condition to determine if else is equivalent to C 8 loop for (*;*;*) while doing while the same as cfor in and for-in can only show the index for to show element last foreach
var m = new Map([[1, ‘x‘], [2, ‘y‘], [3, ‘z‘]]);m.forEach(function (value, key, map) { console.log(value);});
9map set with C++stl

Dabbler Rookie Learn Web Development 2--javascript Study 1

Related Article

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.