Why i hate Javascript

JavaScript has been one of the most popular programming languages for many years. it is deferentially the most widely used language. But it is nonsense. These are the reasons why I stay away from JavaScript

there’s no Static Type

yes, ther…

Alt Text
JavaScript has been one of the most popular programming languages for many years. it is deferentially the most widely used language. But it is nonsense. These are the reasons why I stay away from JavaScript



there’s no Static Type

yes, there’s no static type and most people think this is good because you can always change a variable type. but no! that’s bad for some reasons:

  • decrease Run-time speed
  • decrease Initialization speed
  • programming mistakes
  • unknown data size and then memory leaks
    im not really say dynamic type is always bad but this is not understandable why javascript have’t static typing



illogical comparisons

this one is more famous in JS. Alt Text
not enough? checkout the examples below

9999999999999999 == 10000000000000000  true
0.1 + 0.2 === 0.3  false // (this website explains https://0.30000000000000004.com )
1.0000000000000001 === 1  true
typeof NaN == 'number'  true
NaN != NaN  true



global variable by default

hmm… how? and why this happen? idk

function my_func() {
    x = 10;
}
my_func();
console.log(x)  10

(i know you can solve it with var or let)
most languages is very sensitive to global variables. even you can’t have global variable in rust (you can use static mut but you need to always use it as a unsafe variable).
because global variables can be altered by any part of the code, that make difficult to remember or reason about every possible use also they can’t be limited to some parts of the code



sort() function

.sort() function is a method for arrays. but idk why it does’t like numeric arrays. see the below example

[8, 19, 24, 1, 5].sort()  [1, 19, 24, 5, 8]

i have explained my reasons, but not sure you agree or not. if no explain in comments


Print Share Comment Cite Upload Translate
APA
Mohammad Ali Chraghi | Sciencx (2024-03-28T22:40:52+00:00) » Why i hate Javascript. Retrieved from https://www.scien.cx/2021/07/25/why-i-hate-javascript/.
MLA
" » Why i hate Javascript." Mohammad Ali Chraghi | Sciencx - Sunday July 25, 2021, https://www.scien.cx/2021/07/25/why-i-hate-javascript/
HARVARD
Mohammad Ali Chraghi | Sciencx Sunday July 25, 2021 » Why i hate Javascript., viewed 2024-03-28T22:40:52+00:00,<https://www.scien.cx/2021/07/25/why-i-hate-javascript/>
VANCOUVER
Mohammad Ali Chraghi | Sciencx - » Why i hate Javascript. [Internet]. [Accessed 2024-03-28T22:40:52+00:00]. Available from: https://www.scien.cx/2021/07/25/why-i-hate-javascript/
CHICAGO
" » Why i hate Javascript." Mohammad Ali Chraghi | Sciencx - Accessed 2024-03-28T22:40:52+00:00. https://www.scien.cx/2021/07/25/why-i-hate-javascript/
IEEE
" » Why i hate Javascript." Mohammad Ali Chraghi | Sciencx [Online]. Available: https://www.scien.cx/2021/07/25/why-i-hate-javascript/. [Accessed: 2024-03-28T22:40:52+00:00]
rf:citation
» Why i hate Javascript | Mohammad Ali Chraghi | Sciencx | https://www.scien.cx/2021/07/25/why-i-hate-javascript/ | 2024-03-28T22:40:52+00:00
https://github.com/addpipe/simple-recorderjs-demo