Home  >  Article  >  Web Front-end  >  JavaScript Learning Preliminary Introductory Tutorial_Basic Knowledge

JavaScript Learning Preliminary Introductory Tutorial_Basic Knowledge

WBOY
WBOYOriginal
2016-05-16 18:31:23981browse

In JavaScript, data types are divided into integers and floating-point types. The floating-point types here are not divided into single precision and double precision. They are represented by double precision. All variable declarations only need to use var (so simple, don’t remember it again). int long float double...) It is whatever type of value you give it. Don't distinguish between characters and strings. In the past, there seemed to be "...cannot be used as a string" when using C#. It's easy to remember, haha...
The String type is also similar to other languages. It has string type methods, which can operate on strings, such as string interception, substring(), etc. The following is an example of JavaScript string manipulation:

Copy code The code is as follows:

< ;title>Example 2-10


Composite data types in JavaScript
There are also arrays and functions in JavaScript . The definition of array is also very similar to C# and C.
The following is an example of an array:
When I looked at it, I suddenly discovered that there is a very interesting operator "===" in JavaScript. This is used to determine whether the data is equal. The data must not only be in the numerical value They must be equal and must also be equal in data type. Oh, this is still a bit confusing.
Copy code The code is as follows:

<script> <br><!-- <br>var x =10; <br>var y =null; <br>if(x==null) <br>{ <br>document.write("The value of x is null<br/>" ); //Output prompt<br>} <br>if(null==y) <br>{ <br>document.write("The value of y is null<br/>") //Output prompt<br>} <br>--> <br></script>

Numeric conversion in JavaScript
There are also numerical type conversions in JavaScript, including explicit conversion and implicit conversion. The conversions are basically similar to C and so on. Since this is a note, I won't write it down.
Like almost all WEB programming languages, "==" and "===" are different. One is to determine whether the values ​​are equal, and the other is to determine whether the values ​​and types are completely equal. I’d better take notes separately in the future. It’s already quite long. For me, I’ve never written anything so long, haha... I don’t have the habit of writing notes alone.
I will send it here today, haha... I will continue slowly in the future.
GOOD GOOD STUDY, DAY DAY UP!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn