0530day04

1.javascript definition:

Scripting language to parse and executed by the browser.

classification:

        1. divided into weak and strong type type. Weakly typed variable is defined is not required when the declared data type, the data type is a variable value determined; strongly typed variable is defined when it has the data to determine the type.

        2. interpreted, line by line
        3. interpreted language, the corresponding language compiler

2.JavaScript using
   the line 1. The wording handle
   2. Internal stylesheet <script> js Code </ Script>      
   3. Waibuyangshibiao <script src = "js end the path of the file .js"> </ Script>
   . 4 external style introducing foreign import module

3.JavaScript code section  
basic core syntax
var variable name = variable value;
naming the variable name: only letters, numbers, _, $ can not start with a number, not a JavaScript keywords and reserved words
 are strictly in JavaScript case sensitive

With the addition of any type of string, the string is spliced, and digital type Boolean, implicit conversion. converted into true convert 1.false 0
type (except string, Boolean) and a digital type of operation is not. NAN adding unsuccessful appears
 NAN (not a number) is not a number, but it is attributed to the type of number  
  () performs symbol, there can perform functions (methods)
browser execute JavaScript code to
open a Web page, press F12. Open development tools found console (console) option on the inside

4. more than two comparison operation in the js
 full equal ===
incomplete equal! ==

JavaScript, because it is weakly typed, so the definition of variables when not entirely clear data types, data types can be determined only after an assignment
== only to compare the contents inside, not to compare data types

=== content and type will be compared, there is a range on false

The logical operation

And only when all is true when it is true

Or at least one of the time it is true true   

6. shells block

JavaScript bomb inside the box is built (the developer is already defined) of a function, that function can be used by our call.
 Three kinds of bomb box
alert box warning
prompt input box pops up
confirm box pops up Cancel
function you want to use, you must call

alert ( "hello") // ( ) performs symbol, a parameter indicative of the brackets. Content warning box  
prompt ( "Enter", "200")    
can receive two parameters. With between parameter "," separated.
The first parameter prompt content

The second parameter indicates the default content input box

7. Enter the pop-up box

The return value is that you input contents of the box, this value can be assigned to a variable
var a = prompt (, "10 " " Please enter the number of pages?"); // function execution after the completion of the legacy content. This is called the return value
console.log (a);

8. This is the built-in functions, the content to be detected can be passed in as a parameter.

Only one parameter to determine whether a variable is a number, the return value can only boolean

There are a = 10; 

var b = "hello"; 

console.log(isNaN())

isNaN () is a digital returns false, not true digital return  

There isnan c = (b); 

console.log(c)

 A method of cast: ... will all be converted to a string type number. If you can not turn or NaN

the parseInt () to an integer  

The need to convert what passed as a parameter. After the conversion is complete to return to the values ​​manifested in the form of

Can intercept interception, the interception would not be as NaN

parseFloat()

If you can convert a decimal, convert to decimal

 

Guess you like

Origin www.cnblogs.com/hhhyyc/p/10951093.html