rauschma / deep-js

https://exploringjs.com/deep-js/
13 stars 0 forks source link

Chapter: Type coercion in JavaScript #2

Open rauschma opened 4 years ago

raigorx commented 4 years ago

https://exploringjs.com/deep-js/ch_type-coercion.html#what-is-type-coercion

"In (3), the operation performs an implicit type conversion. That is called type coercion."

It looks more like an explicit type conversion, or I am wrong?

changchangge commented 4 years ago

https://exploringjs.com/deep-js/ch_type-coercion.html Hello,in this chapter,I think this will confuse people who is reading。

// Error values

assert.equal(1 / 0,  Infinity)

// but in console

(1 / 0) === Infinity // true
championballer commented 3 years ago

As @raigorx said, it seems to be explicit type casting rather than implicit type casting. Whereas assert.equal(3 * true, 3); looks like implicit type conversion and hence by definition would be type coercion. Right?

Jumballaya commented 1 year ago

Looks like there is a grammatical error in section 2.4.1 paragraph 1, second sentence: It converts an arbitrary values to primitive values.

The 'an' in there seems off. It feels like it was supposed to read 'It converts an arbitrary value to a primitive value' but the second half of the sentence is pluralized.

Maybe replace 'an' with 'the' to keep it all pluralized?