In JavaScript, data types are divided into integer and floating-point types. The floating-point types here are not divided into single precision and double precision. The same uses double precision for declarations. All variables only need to use var (so simple, don't remember int long float double...) What type of value you pay it to, it is what type. Don't distinguish between characters and strings. In the past, it seemed that sometimes, when using C#, there seemed to be "...not to be used as a string". It's easy to remember, haha...
The String type is also similar to other languages with string type methods, which can operate on queue strings, such as string interception substring(), etc. Here is an example of string operation in JavaScript:
<title>Example 2-10</title>
<script language="javascript">
<!--
// Content of the poem
var comment = "I missed the bright moonlight in front of Li Bai's bed in a quiet night, and I suspected it was frost on the ground. I looked up at the bright moon and thought of my hometown.";
var partial = ( 0, 3 ); // Remove the title
partial = (); // Thicker title
( "<p align=\"center\">" ); // Output the HTML tag "<p>" and set centered alignment
( partial ); // Output title
partial = ( 3, 5 ); // Remove the author
( "<br/>" ); // Output line break tag<br/>
( partial ); // Output author
partial = ( 5, 17 ); // Take out the first poem
partial = ("gray"); // Set the color to gray (gray)
( "<br/>" ); // Output line break tag
( partial ); // Output verses
partial = ( 17, 29 ); // Take out the second poem
partial = ("gray"); // Set the color to gray (gray)
( "<br/>" ); // Output line break tag
( partial ); // Output verses
( "</p>" ); // Output the end tag of the HTML tag "<p>"
-->
</script>
Composite data types in JavaScript
There are also arrays and functions in JavaScript. The definition of arrays is also very similar to C# and C++.
Here is an example of an array:
As I looked at it, I suddenly found that there is an interesting operator "===" in JavaScript. This is used to determine whether the data is equal. The data must not only be equal in the values but also in the data type. Oh, this is still a bit dizzy.
<script>
<!--
var x =10;
var y =null;
if(x==null)
{
("x value is empty<br/>"); //Output prompt
}
if(null==y)
{
("y value is empty<br/>") //Output prompt
}
-->
</script>
Numerical conversion in JavaScript
In JavaScript, there are also numerical conversions, display conversions and implicit conversions, which are basically similar to C++, etc., because this is a note, I won't write it.
Like almost all WEB programming languages, "==" and "==" are different. One is to judge whether the values are equal, and the other is to judge whether the values and types are exactly equal. This is better to take notes separately in the future. It has been relatively long. For me, I have never written anything that long. Haha... I don’t have the habit of writing notes alone.
I'll send it here today, haha... Let's continue slowly in the future.
GOOD GOOD STUDY ,DAY DAY UP!
The String type is also similar to other languages with string type methods, which can operate on queue strings, such as string interception substring(), etc. Here is an example of string operation in JavaScript:
Copy the codeThe code is as follows:
<title>Example 2-10</title>
<script language="javascript">
<!--
// Content of the poem
var comment = "I missed the bright moonlight in front of Li Bai's bed in a quiet night, and I suspected it was frost on the ground. I looked up at the bright moon and thought of my hometown.";
var partial = ( 0, 3 ); // Remove the title
partial = (); // Thicker title
( "<p align=\"center\">" ); // Output the HTML tag "<p>" and set centered alignment
( partial ); // Output title
partial = ( 3, 5 ); // Remove the author
( "<br/>" ); // Output line break tag<br/>
( partial ); // Output author
partial = ( 5, 17 ); // Take out the first poem
partial = ("gray"); // Set the color to gray (gray)
( "<br/>" ); // Output line break tag
( partial ); // Output verses
partial = ( 17, 29 ); // Take out the second poem
partial = ("gray"); // Set the color to gray (gray)
( "<br/>" ); // Output line break tag
( partial ); // Output verses
( "</p>" ); // Output the end tag of the HTML tag "<p>"
-->
</script>
Composite data types in JavaScript
There are also arrays and functions in JavaScript. The definition of arrays is also very similar to C# and C++.
Here is an example of an array:
As I looked at it, I suddenly found that there is an interesting operator "===" in JavaScript. This is used to determine whether the data is equal. The data must not only be equal in the values but also in the data type. Oh, this is still a bit dizzy.
Copy the codeThe code is as follows:
<script>
<!--
var x =10;
var y =null;
if(x==null)
{
("x value is empty<br/>"); //Output prompt
}
if(null==y)
{
("y value is empty<br/>") //Output prompt
}
-->
</script>
Numerical conversion in JavaScript
In JavaScript, there are also numerical conversions, display conversions and implicit conversions, which are basically similar to C++, etc., because this is a note, I won't write it.
Like almost all WEB programming languages, "==" and "==" are different. One is to judge whether the values are equal, and the other is to judge whether the values and types are exactly equal. This is better to take notes separately in the future. It has been relatively long. For me, I have never written anything that long. Haha... I don’t have the habit of writing notes alone.
I'll send it here today, haha... Let's continue slowly in the future.
GOOD GOOD STUDY ,DAY DAY UP!