Home > Enterprise >  JavaScript data types
JavaScript data types

Time:09-15

Development tools and key technology: Adobe Dreamweaver JavaScript
Author: wave change
Time to write: on April 20, 2020
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Knowledge points list:
1.0 JavaScript literals with variable
Some literal: you can't change the value of the
For example: 1 3 5 6
Literal can be used directly, but we typically do not directly use literal
Variables: variables can be used to save the literal and the value of a variable can be arbitrarily change
Variables are more convenient, we use so in hair open by variables to save literal
Variable declaration: through the var keyword statement
2.1 JavaScript identifiers
- in JS all can independently by our naming can be referred to as identifiers
- such as: variable name function name attribute names belong to identifier
- named an identifier is the need to comply with the following rules:
1. The identifier can contain letters, Numbers, _ (underscore), $
2. The identifier cannot begin with digital
3. The identifier cannot use ES of keywords and reserved words
4. The identifier is generally USES the hump written
- first letters lowercase, at the beginning of each word uppercase letters lowercase
the restFor example: a small hump helloWorld big hump helloWorld
JS underlying identifier for storage when actual use is Unicode
So in theory, all utf-8 contains content can be used as identifiers
(note: including the Chinese, Chinese can be used as identifier, but don't use so) (2) converts other data types to a Number of type
Use the Number () function
- string - & gt; Digital
1. If it is pure digital string can be directly converted into digital
2. If the content of the string contains non-numeric, converted to NaN
3. If the string is an empty string or a string, all Spaces are converted to 0
- Boolean value - & gt; For converting true must change to 1 false 0
- null - & gt; 0
- undefined - & gt; Digital NaN
  • Related