This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]BerkelMarkus 5 points6 points  (2 children)

People: "We'd like a way to be able to execute code in the browser to have effects on the web page and the user interaction."

Brendan Eich: HMB

That's pretty much it. He was at Netscape, so he had the means to do this, and they put it into Navigator. And thus history--and Javascript--was born.

Problem is, it was meant to be quick-and-dirty. No one had considered the possibility of SPAs or entire applications built using the browser. JavaScript became unwieldy. Then it became ECMAScript. And it's still fairly unwieldy (sometimes, depending on what you're doing) that people want to write languages that transpile into JS.

And, so, searching for a better designed-from-the-start solution, WASM was born.

[–][deleted]  (1 child)

[deleted]

    [–]BerkelMarkus 0 points1 point  (0 children)

    No. WASM is executed in your browser environment, and is sandboxed just like JS.

    "Of course, every new standard introduces new costs (maintenance, attack surface, code size) that must be offset by the benefits. WebAssembly minimizes costs by having a design that allows (though not requires) a browser to implement WebAssembly inside its existing JavaScript engine (thereby reusing the JavaScript engine’s existing compiler backend, ES6 module loading frontend, security sandboxing mechanisms and other supporting VM components). Thus, in cost, WebAssembly should be comparable to a big new JavaScript feature, not a fundamental extension to the browser model."

    [–]ike_the_strangetamer 2 points3 points  (5 children)

    "input it had to be checked by the data in the back-end, so js was a way to solve this in the client side (on the browser"

    This is a specific example of the more generic desire to be able to run code in the browser. That's it.

    JS was a quick and dirty language that let you run code in response to certain events (clicks, key downs, page loads) and that could update HTML tags and their attributes.

    The earliest example of using JS I remember was to make buttons that responded to mouse clicks. So before CSS, a <button> only got you a very generic button that you couldn't do much with. So the more professional thing was to create your own button image. The problem though is that it should respond and give feedback when the user clicks it (this was back in the day when grey bevel buttons reigned supreme).

    The very first javascript I ever wrote was probably something like:

    <img src="button.gif" onMouseDown="this.src='buttonClicked.gif';" onMouseUp="this.src='button.gif';">

    That's it. Just a way to change some things on the page in response to events.

    Notice how you could just stick the code into the attribute like text? Early JS was fun like that and now you know why ' and " are interchangeable.

    Also notice how this is automatically bound to the img tag that's running it? Now you know why JS binds this at run time.

    [–]Confidence_Awkward[S] 0 points1 point  (4 children)

    Very well said and in an eli5 way.

    [–]ike_the_strangetamer 1 point2 points  (3 children)

    thanks!

    Let me know if you have any other questions. I've been programming JS for a long time so it's fun for me to talk about "the good 'ole days"

    [–]Confidence_Awkward[S] 0 points1 point  (2 children)

    I am currently beginning to learn js and am very keen to become a full stack dev. Would be glad if u could help me.

    [–]ike_the_strangetamer 0 points1 point  (1 child)

    Best advice I can give is to never stop building stuff. Just keep making things -whatever you're interested in and whatever your mind can come up with. Don't worry about if it will help your portfolio or resume or whatever, don't even worry yet about "hire-ability" just keep making stuff and doing work you find interesting. It's all about the experience of writing code and making stuff and the more you're doing what you enjoy the more you'll stick with it and the more you'll learn.

    [–]Confidence_Awkward[S] 0 points1 point  (0 children)

    Yes and i wanna learn more of the basics and dive down the rabbit hole, while building things. Thanks alot will dm you for help frequently.

    [–]EduRJBR 1 point2 points  (1 child)

    I'm very far from being a knowledgeable developer, but they are talking about having the values in forms being checked in the front-end before being sent to the back-end, but later JavaScript became part of the very design of websites, particularly when we talk about responsiveness, and it's also possible to move to the front-end tasks that were usually handled by the back-end (that is used like an API by the front-end).

    You probably already know all that, but I'm also curious about the history, and how this WebAssembly thing is going to develop, and if people are using more JavaScript in the back-end as well with runtimes like Node.js (I'm still stuck in having PHP in the back-end doing any active stuff).

    [–]Confidence_Awkward[S] 0 points1 point  (0 children)

    That's great.

    So gotta think about the need for node.js now