JavaScript (basic)

A, javascript scripting language used by the browser to parse and execute
 1. weakly typed strong typing
     weak typing in the definition of a variable declaration is not required when the data type, data type is a variable value determined by the
      JavaScript
     strongly typed variables in the definition of when it has the data to determine the type of
         the Java
          int a

 2. explain line execution
 3. interpreted language corresponding to the language compiler
    python c / c ++
    translation of a see a later convenient all Translation
    efficiency interpreted <compiled
     
   two, JavaScript using
   the line 1. The wording handle
   2. Internal stylesheet <script> js Code </ Script>      
   3. Waibuyangshibiao <script src = "js to the end of the file path .js"> </ Script>
   4. external introducing foreign import module style
   
   writing time is put css inside the head of
   writing JavaScript that can be placed anywhere
   on the bottom of the page is best
   except in exceptional circumstances

Three, JavaScript code is part of the
   
 basic core syntax
 variables: the amount will become
 the definition of variables  

 var keyword to define variables of
 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
 in JavaScript is strictly case sensitive ., for example: var B2, B2 var
var a = 123; in a programming language, a = number for assignment, showing two == Analyzing
the data type of the original data type
 number string boolean undefined null
 string of numbers defined Boolean space

Reference data types
Object object

Four, JavaScript's Math

plus

1. Any type with string concatenation, are strings splice
2. The number and type Boolean, implicit conversion. True converted into a converted 1.false 0
3. numeric type and not the type of operation (except string Boolean). 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 to find the console (console) option inside
minus
1. can subtract / multiply / divide would reduce, not subtract / multiply / divide the NaN
2. can subtract / multiply / divide: the Boolean, when the string comparison particular time (the string of numbers all the time)

Five, JavaScript sign

Greater than>
greater than or equal to> =
Less than <
Less than or equal <=
equal ==
not equal! = 
 More js in two
 congruent ===
insufficiency 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 type
=== content and type will be compared, there is a range on false
! =,! ==

Six, JavaScript logic operation

And: Only when all is true when it is true

Or: at least one of the time it is true true   

Non-: negated

Seven, JavaScript bomb box

JavaScript is built inside the housing shells (developer already defined) to a function.
  Function is for us to 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
the implementation symbols, brackets indicates parameter alert ( "hello") // ( ). Content warning box
can receive two parameters. With between parameter "," separated.
 The first parameter represents the contents to
the second parameter indicates the default content input box

Enter the pop-up box:
The return value is that you input contents of the box, this value can be assigned to a variable

Built-in functions, the content needs to detect the passed in as a parameter. Only one parameter, it is determined whether a variable is numeric, the return value only boolean var a = 10; var b = "hello"; console.log (isNaN ())

isNaN () is a digital returns false, the number returned is not true var c = isNaN (b); console.log (c) Method of cast: ... will all be converted to a string type number. If not turn, compared with NaN / parseInt () // to an integer, to be converted to what passed as a parameter. After the conversion is completed to return the value of forms, and can intercept interception, it is not taken NaN

Guess you like

Origin www.cnblogs.com/phioo/p/10951358.html