Can this alogrithm done without declaritive programing

@Ramiz_Qazi

I can certainly understand the understand what is happening on a deeper level. But JS isn’t the right language for that since it is not a low level language. A low level language like that would not work on the web since you would have to deal with the peculiarities of each OS and browser differently. JS makes this easier by abstracting away from that and not having to worry about it.

If you really want to get into those things, then a language like C, or even Assembly would be better. C is very low level and Assembly is as low as you can get without writing in 1s and 0s. You would learn a lot of interesting things. But they would not necessarily help you in understanding web development.

I think at some point you have to pick a path and stick with it, especially in the beginning. If you’re interesting in web development, then I think things like this can be a bit of a distraction, at least in the beginning. There will be plenty of time to study those things later.

I would add that replicating the function of the prototype methods can be a good learning tool. I still think the methods of duplicating string methods in JS are clumsy, but you can still learn from them. At one point I went and wrote my own versions all the array prototype methods - it was very instructive. But when it comes down to it, I just use the standard JS ones and be glad that they’re there.

In short, don’t worry about it so much.

3 Likes

I think everyone above has made pretty good points as to why in a production environment you are going to want to use built in methods, but should you really want to get into the nitty and gritty of how JS works you are going to need to read on how different engines work, and thats probably not what you want.

On a more fundamental level you have ECMAScript which describes what JavaScript is, but is not how its implemented which is good because at my level and yours as well its way more useful to understand and know the spec than it is to know how google made the v8 engine.

Personally I think MDN does a good enough job of explaining, and is easier to understand, but its good to read the actual spec sometimes:
https://262.ecma-international.org/5.1/

If you are really interested in a specific implementation of ECMAScript here is:
https://v8.dev/docs
I have not read any of it so I don’t know what they actually say

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.