FrontendMasters / front-end-handbook

The resources and tools for learning about the practice of front-end development.
http://www.frontendhandbook.com
1.8k stars 292 forks source link

JavaScript is an untyped language #58

Closed jbruni closed 8 years ago

jbruni commented 8 years ago

Please check my comment here: https://github.com/FrontendMasters/front-end-handbook/commit/01b5dccdcd91ab4fcd40b87bbf0416d4dd23f15a#commitcomment-15361978

Pardon me for the light dose of irony.

1Marc commented 8 years ago

JavaScript is loosely-typed language? Might be more appropriate. Maybe @getify could make this more true somehow...

tonykung06 commented 8 years ago

I think it is fair to say JS is not statically typed. It differs from C#, Java in that a variable can refer to difference types of values at runtime

getify commented 8 years ago

JavaScript most definitely has types. Moreover, JS has a rich system of conversions between its various types, generally called coercion.

Saying JS is not typed is to nitpick about the word "type" as compared to other languages' definitions of that word, such as Haskell. Those arguments are pointless.

JS is not type-enforced (aka "statically typed"), in that the compiler does not check types and enforce type matches in operations. Instead, JS is loosely-typed (aka "dynamically typed"), meaning runtime conditions determine the type of a value for any given operation.

1Marc commented 8 years ago

Thanks for chiming in @getify!

jbruni commented 8 years ago

:+1: I appreciate the discussion, and I am learning new and interesting things as it goes.