JS type conversion, operator, statement

Source: Internet
Author: User

1. Type conversion:

  It is divided into automatic conversion and casting, which is generally used for casting.

Convert other types to integers:parseint();int integer

Convert other types to decimals:parsefloat(),float decimal (short after decimal point )

Determine if it is a valid number type:isNaN(); emphasis

is a number then returns false, not a number to return ture. similar to bool in C #

@ Note the need to put prompt in the isNaN method This is an easy to forget point;

2. operators:

  math operator :+ -*/% + +-- priority level reduced

  relational operators := = ! = >= <= > <;

  logical operators :&& | | ! ;

  Other operators :+ = = *=/=%=? :;

3. statement:

 It is generally divided into sequential, branching, and cyclic statements.

(1) Branch statement if:

If(judging condition)

{

Statements that meet the criteria to be executed

}

Else

{

Statements executed when a condition is not met

}

(2) loop for statement:

For( initial condition; cyclic condition; state change )

{

  Loop body

}

(3) problem type: exhaustive, iterative. two classic case 1+2+. +100=? and 100 numbers to find a number associated with 7

(4) Two keywords:break(jump out of the end metaphor eat to fly ) and continue ( abort the cycle into the next cycle metaphor eat to eat to the sand ).

(5) If you want to output the value of a parameter: The output value is "+a+" and "+b" should be replaced with placeholders {0} ....

<script>function visible1 () { $("P"). hide ();}; need to load a plugin jquery official website

</script>

<body>

<input type= "button" onclick = "visible1 ()" value = " dot here let text disappear "/> button

<p> I will disappear. </p> Tags

$ ("Id1") is equivalent to document.getElementById("Id1")

* content is very broken but to master is to memorize more with a few and C # There are many are interlinked

JS type conversion, operator, statement

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.