DEV Community

Gomandev
Gomandev

Posted on

What will you change or add in javascript if you have a chance?

I was asked this question in an interview sitting a couple of months ago. I'm pretty sure some of you really ever thought of changing something in JS language.

I will be happy to know your opinion in the comment.

Top comments (27)

Collapse
 
kaviisuri profile image
KaviiSuri

DATE!!!
The date and time in javascript is so messed up, the community had to create libraries for basic tasks like date and time management.
Luckily, there is a new API coming called the Temporal API. Fingers Crossed 🤞

Collapse
 
gomandev profile image
Gomandev

Great update!

Collapse
 
manoharreddyporeddy profile image
Manohar Reddy Poreddy • Edited

I will be much more productive if below are available:

JavaScript

  • Add more data structures
    • stack, queue, heap/ priority_queue, trie, etc from c++/java/python
  • Add more algorithms
    • binary_search, upper_bound, lower_bound, etc from c++/java/python
  • Even shorter syntax constructs where possible
  • Make things faster where possible
    • .forEach is slow most cases

Node.js

  • Start execution from function main() if given, with command line args to it
Collapse
 
gomandev profile image
Gomandev

Great suggestions, man. Having an inbuilt algorithm data structure will be fantastic.

 
nombrekeff profile image
Keff

Ohh yeah, I'm aware.. I agree that they are kinda unnecesary, but they make my life a bit easier. I fricking hated constructor functions, but now I kinda enjoy working with "classes". I prefer not to if I can, but sometimes I need to

Couldn't we also consider that high-level programming languages are also just sugar?

Thread Thread
 
nombrekeff profile image
Keff • Edited

One of the things I like about arrow function is that, you don't need to fill your code with the function keyword, reducing the amount of noise and clutter. I really enjoy those kinds of things, where you don't need to write unnecesary keywords. Take Java for example, a big percentage of the code is just public, private, final, static... I don't enjoy that, it's a mess (but they have a place and I can see the value of them).

And although I would not like this change to be implementet, I get your point :P

I'm willing to bet folks will like JS to be even more class heavy

Let's hope it does not go that way, at least not excesively 🤞

I guess everyone is welcome to imagine the ideal JS for them 😄

Of course, that's what I like about this types of posts, they make us talk about this things and respectfully debate them

Collapse
 
insidewhy profile image
insidewhy

Even in pure functional languages like Haskell, there are things like classes. Sometimes classes even enable more elegant functional designs. Sure people abuse OO horribly, but removing classes from the language entirely is too dogmatic.

Collapse
 
siddharthshyniben profile image
Siddharth

Only if you did this, almost every site would break.

Collapse
 
taufik_nurrohman profile image
Taufik Nurrohman

Rename XMLHttpRequest with XMLHTTPRequest.

Collapse
 
auroratide profile image
Timothy Foster

change it to be from "location" import { thing }

Now that you mention it, I never realized how much I wanted this syntax until now.

Collapse
 
hiro98 profile image
Valentin Boettcher

Make it never happen in the first place :P.

Collapse
 
hiro98 profile image
Valentin Boettcher
Collapse
 
exenestecnico profile image
Ernesto

I cringe reading this. You want to remove mostly optional stuff to make JS more like other language. My guess is you don't want to use JS and really want Python support in browsers.

 
insidewhy profile image
insidewhy • Edited

No you can't, not when private data has to be encapsulated into a struct like concept, not unless you're willing to sacrifice a great deal of performance and memory.

I think you're being too dogmatic.