Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 25, 2021 03:13 pm GMT

Why i hate Javascript

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 leaksim 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  true0.1 + 0.2 === 0.3  false // (this website explains https://0.30000000000000004.com )1.0000000000000001 === 1  truetypeof NaN == 'number'  trueNaN != 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


Original Link: https://dev.to/alichraghi/why-i-hate-javascript-22pb

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To