Core operations and principles of Data Types

Source: Internet
Author: User
# Core operating principles of data types> data types (value types) in JS> + number> + String> + Boolean> + null> + undefined>-reference data type> + Object> + {} Common Object> + [] array> function> + function Common Function> + class> +...
JS Code runs in the browser because the browser provides us with an environment for JS Code Execution-> global scope (window/Global)

''' Criptvar A = 12; var B = A; B = 13; console. Log (a); // A-> 12
VaR o = {Name: 'yy'}; var P = O; p. Name = 'kpf '; console. Log (O. Name); // A-> KPF
VaR M = {Name: 'yy'}; var n = m; n = {Name: 'yy'}; console. log (M. name); // A-> YY
// Sum of any number and function FN () {var ary = array. prototype. slice. call (arguments); EVAL (ary. join ('+');} FN (12, 13 );'''
### Value type> directly operate by value, for example, var a = 12; directly assign the value of 12 to variable A (establish a link between variable A and the value of 12)
### Object data type> if an object is encountered in JS, perform the following operations:> 1. the browser does not open up a new memory space, if it is not convenient to find the space later, the browser will allocate a hexadecimal address to the space> 2. in a certain order, respectively store the object key-value pairs in the memory space> 3. Assign the address that opens the memory to the variable (or something else)
### Function operations> Create a function> 1. First open up a new memory space (without a 13-digit address allocated)> 2. Store the js code written in the function as a 'string' to the space (it makes no sense to create a function without executing it)> 3. Assign the assigned address to the declared function name (function FN and var fn operate in the same way, both of which indicate a name and a variable name in the current action, one is the function name)> execute the Function

Core operations and principles of Data Types

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.