Get the App
SLTechnology News&Howtos  ›  Development  › 

Case of JavaScript letters and analysis of function examples

Shulou Source: shulou.com Published: 2022-06-01 10:32:11 09月29日 Update

This article mainly introduces the relevant knowledge of JavaScript letter case and function instance analysis, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value, I believe you will have something to gain after reading this JavaScript letter case and function example analysis article, let's take a look.

JavaScript comment

Not all JavaScript statements are "commands". The content after the double slash / / is ignored by the browser:

/ / I will not execute

JavaScript data type

JavaScript has a variety of data types: numbers, strings, arrays, objects, and so on:

Varlength=16;//Number is assigned by numeric literal quantity

Varpoints=x*10;//Number assigns values through literal quantities of expressions

VarlastName= "Johnson"; / / String is assigned literally through a string

Varcars= ["Saab", "Volvo", "BMW"]; / / Array is assigned by array literals

Varperson= {firstName: "John", lastName: "Doe"}; / / Object is assigned literally through the object

The concept of data types

Data type is a very important content in programming language.

In order to manipulate variables, it is important to understand the concept of data types.

If the data type is not used, the following instances cannot be executed:

16 + "Volvo"

16 how is the addition of "Volvo" calculated? Will the above result in an error or output the following result?

"16Volvo"

You can try to execute the above code in the browser to see the effect.

You will learn more about data types in the following chapters.

JavaScript function

JavaScript statements can be written in functions, and functions can be referenced repeatedly:

Reference a function = call the function (execute the statement within the function).

FunctionmyFunction (a _ r _ b) {

Returna*b;// returns the result of a times b

}

JavaScript letter case

JavaScript is case-sensitive.

When writing JavaScript statements, be careful to turn off the case switch key.

The function getElementById is different from getElementbyID.

Similarly, the variables myVariable and MyVariable are different.

This is the end of the article on "JavaScript letter case and function example Analysis". Thank you for reading! I believe you all have a certain understanding of the knowledge of "JavaScript letter case and function example analysis". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Functions data types sizes letters instances literals instance analysis analysis content knowledge statements differences important variables characters strings objects numbers arrays Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Tech Info vpn MariaDB Docker