Video address

P16 – Variable syntax extension

  • In JavaScript,;Indicates the end of a statement or is used as a separatorfor3 segments in the statement.
  • The comma.Usually used to separate two clauses, or to separate arguments in a function definition or call.
  • Such as:var i = 0, j = 2; for (var k=0 ; k < j; K ++) {I = I + round(4 * (k + 1) * 3.14159, 2); }
  • In CSS, a semicolon indicates the end of a style definition, and a comma is used to separate elements that use the same style. For example:a.button, input.button { display: inline-block; width: 100px; height: 50px; }

Code screenshots The results

<script> // 1. Define var myname = 'Andy Lau '; console.log(myname); myname = 'bob'; console.log(myname); Var age = 18, sex = 'man', address = 'hanzghou'; // 1. Use qq = 110; console.log(qq); Var city = undefined; var city = undefined; console.log(city); // 3.3 Error console.log(tel); </script>Copy the code

P17 – Naming conventions for variables

An error will prompt the editor with a red wavy line.

Code screenshots

The results, name is undefined, but a blank line is output

Var app = 'app'; console.log(app); Var App = 'App'; console.log(App); // Can not use the keyword // var var; Console.log (name) </script> </script>Copy the code

P18 – Swaps the values of two variables

P19 – Variable summary

P20 – Data type guidance

P21 – Introduction to data types

JavaScript is a weakly typed or dynamic language, meaning that variable types are not declared in advance and are determined automatically as the program runs.

P22 – Number type

JS data types fall into two categories:

  • Simple data types:Number, String, Boolean, undefind, null
  • Complex data types:object

Numeric range

console,log(Number.MAX_VALUE); / / Max

console.log(Number.MIN_VALUE); / / the minimum

Numeric type with three special values

p23-isNaN

P24 – A String

  • The syntax is single quotation marks' 'And double quotation marks""
  • String nesting: outside single inside double, outside double inside single, nearby principle.
  • Var STR = "I am a programmer ";

Escape character

  • String escape characters begin with \, but these escape characters are enclosed in quotes.

  • Var STR = "I am a programmer \n ";

P25 – The web page warning box is displayed

  • Alert (" Pop up the alert box, here to newline, \n try! \n \t here indented ");

P26 – String length and concatenation

* String length

  • Check to get the length of the stringlength
  • var str = 'my name is andy'
  • console.log(str.length)
  • The output

P27 – String concatenation enhancement

P28 – Shows age cases

P29-boolean and undefined and null

P30-type-of Indicates the data type of a variable

P31 – literal

P32 – Converts to string type

P33 – Converts numeric parselnt and parseFloat

P34 – Converts alphanumeric numbers and implicit conversions

P35 – Calculate age cases

P36 – Simple adder case

P37 – Convert to Boolean

P38 – Expand reading on compiled language differences

P39 – Extended reading of identifier keyword reserved words

P40 – Homework