Home > Web Front-end > Front-end Q&A > What is javascript syntax

What is javascript syntax

藏色散人
Release: 2023-01-07 11:41:46
Original
3483 people have browsed it

JavaScript syntax is a set of rules that defines the language structure of JavaScript; JavaScript is a scripting language and a lightweight but powerful programming language.

What is javascript syntax

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

What is the syntax of javascript?

JavaScript syntax is a set of rules that defines the language structure of JavaScript.

var x, y;// 如何声明变量
x = 7; y = 8;// 如何赋值
z = x + y;// 如何计算值
Copy after login

JavaScript Values

JavaScript statements define two types of values: mixed values ​​and variable values.

Mixed values ​​are called literals. Variable values ​​are called variables.

JavaScript literals

The most important rule for writing mixed values ​​is:

You can write values ​​with or without a decimal point:

15.90
10011
Copy after login

A string is text, surrounded by double or single quotes:

"Bill Gates"
'Bill Gates'
Copy after login

JavaScript Variables

In programming languages, variables are used to store data values.

JavaScript uses the var keyword to declare variables. The

= sign is used to assign a value to a variable.

In this example, x is defined as a variable. Then, the value assigned to x is 7:

var x;
x = 7;
Copy after login

For a more detailed introduction to JavaScript syntax, please visit the "javascript Syntax" chapter in the manual.

The above is the detailed content of What is javascript syntax. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template