+ 1
what is type coersion
example also please.
2 Answers
+ 3
"Type coercion is the automatic or implicit conversion of values from one data type to another (such as strings to numbers). Type conversion is similar to type coercion because they both convert values from one data type to another with one key difference â type coercion is implicit whereas type conversion can be either implicit or explicit."
Source: https://developer.mozilla.org/en-US/docs/Glossary/Type_coercion
Type casting is an explicit form of type conversion. With coercion, the types are converted implicitly, that means you are not spelling out in the code that you want the type changed, but the javascript interpreter will have no other choice, for example if you try adding a string and a number.
+ 1
is it same like type casting