for example if we run this part of code:
var str="test"; console.log(str.length) console.log(str.length=3)
output should be like this:
The assignment operator always returns the right-hand value. Hence, passing the expression inside the console.log function returns the right-hand value, in your case 3.
Assigning any value to the length property of a string has no effect.
let myString = "Hello,World!"; myString.length = 4; console.log(myString); // expected output: "Hello,World!" console.log(myString.length); // expected output: 12