The use of "=" operator is that it assigns value from right to left, whereas "==" shows whether the given values are equal or not.In the following example variables x and y were assigned values using "=" operator and their magnitudes were checked using "==" operator.
Example
<html>
<body>
<p id="equal"></p>
<script>
var x = 5;
var y = "6";
document.write(x);
document.getElementById("equal").innerHTML =
(x == y);
</script>
</body>
</html>Output
false 5