I searched through the internets but could not find a relevant search criteria so I thought this would be the best place to ask.
I have a JS statement saying
document.location.hash = this.slug = this.sliceHashFromHref(href)
How does this work??
JavaScript statements are composed of: Values, Operators, Expressions, Keywords, and Comments.
The loop initialization where we initialize our counter to a starting value. The initialization statement is executed before the loop begins. The test statement which will test if the given condition is true or not.
In Javascript the ${} is used to insert a variable to a string.
JavaScript hides this power. C is commonly used for embedded computers and applications that require high performance such as operating systems. JavaScript was first embedded only in web pages, but it is finding a new role in server applications developed through Node. js.
How does this work??
a = b
can be seen as both a statement and an expression.
The result of the expression is b
.
In other words,
a = b = c;
which can be written as
a = (b = c);
is equivalent to
b = c; a = b;
Thus your code is equivalent to:
this.slug = this.sliceHashFromHref(href); document.location.hash = this.slug;
Be aware of the variables scope!!
var A = B = C = 3; //A is local variable while B & C are global variables; var A = 3 , B = 3, C = 3;// A B C are local variables;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With