JavaScript (JS) Language basics

Source: Internet
Author: User

JavaScript (JS) It is a powerful language, but JavaScript (JS) can not go to operate the database alone. We need to know that its output syntax is 3, this is alert (""), Confirm (""), and Prompt (""). Variable, var a=1000;var b=10.5;var C=d; This writing is wrong, because the write "D" is undefined, the computer takes it as a variable, and then found in the execution "D" is undefined, so reported the error, the correct way to write "D" in single quotation marks or double quotation marks. Alert (A+B) Here is not the literal a+b, it means that the value of a to add the value of B, var a= "" "Var b=10.5 alert (a+b) This situation Plus is a concatenation effect, the result is 100010.5. A=parseint (a); This is a delegate to an integer, parsefloat (a) which is a turn decimal. var a=prompt ("Enter a number"), Var b=promt ("Enter another Number"), (note that whatever the user enters is a string). Then turn to an integer in the Operation var sum=parseint (a) +parseint (b); alert (sum) and output. var A=100;var b=12;alert (A/b) will get 8.33333 (endless 3) except for the infinite, but in int a=100;int b=12;a/b will get 8, after the decimal is not, no rounding, this is a strong type, regardless of subtraction is an integer. Alert (a%b) This represents a÷b not divisible by the words of the remainder to be taken. In these operations, an equal sign is an assignment, two are equal, and three are identical. The last one is the ternary operation var c=a==b? " OK ":" on "//condition? satisfies the conditional return value: The conditional return value is not met. Basic knowledge of language.

JavaScript (JS) Language basics

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.