amit amit - 3 months ago 6
Javascript Question

Javascript a=b=c statements

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??

Answer

Its get evaluted from right to left. i.e

document.location.hash = this.slug = this.sliceHashFromHref(href)

output/value of

this.sliceHashFromHref(href)

is get assigned to document.location.hash = this.slug