4 ms·
It's similar to writing build(): string { ... but they generate different JavaScript. The way it's written will give each instance its own reference to th
by mcbits 10y ago
It's similar to writing
build(): string { ...
but they generate different JavaScript. The way it's written will give each instance its own reference to the function. The "build(): string" above will add the function to the prototype, which is shared by all instances.
I'm not sure whether the code takes advantage of this difference in some way or not. If not, it's just a slightly more awkward and less efficient way of defining a method.