Home > Web Front-end > Front-end Q&A > Does javascript have =?

Does javascript have =?

藏色散人
Release: 2022-01-18 11:20:38
Original
1983 people have browsed it

Javascript has the = symbol, which represents the assignment operator and is used to assign values ​​to JavaScript variables. Its usage is as follows: "var x=10;var y=5;x=y;var demoP=document.getElementById (...)".

Does javascript have =?

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

Does javascript have =?

javascript has = symbol.

JavaScript assignment operator

The assignment operator is used to assign values ​​to JavaScript variables.

Code example:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title></title> 
</head>
<body>

<p>设置 x=10 和 y=5, 计算 x=y, 并显示结果。</p>
<button onclick="myFunction()">点我</button>
<p id="demo"></p>
<script>
function myFunction()
{
	var x=10;
	var y=5;
	x=y;
	var demoP=document.getElementById("demo")
	demoP.innerHTML="x=" + x;
}
</script>

</body>
</html>
Copy after login

Result:

Does javascript have =?

## Recommended study: "

js basic tutorial"

The above is the detailed content of Does javascript have =?. 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