The new Javascript?

Alex Badea

To prevent 🔥 war

the disclaimer is on the next slide

In the interest of preventing discussions with the purpose of defending Javascripts honor, this slide shall attempt to stop unwanted, emotional or unproductive debates over the state of Javascript in comparison to other languages as this is not the purpose of the aforementioned presentation. Thusly this presentation considers itself an informational text with a cheeky name simply to raise interest in a fairly new language that has the potential to help some developers with their struggles. Should you actually consider Reason to be a better idea for you than Javascript we will still love you just as much as before, as long as you still make the occasional offering to the Javascript god. If you actually read this slide up to here you may realize that you did not pay attention to what Alex has been saying. Unless, of course, you have impeccable distributive attention, in which case you did alright. Leleu, please keep a close eye at my beer while I am holding my speech and bring me a new one if I happen to finish it. The rest of the disclaimer text does not fit very well in the rest of this slide so you will not read it.

Js world interests

Functional

Immutability

Types

Cross-platform

What does this have to do with Javascript?

  • Bucklescript
  • JSX
  • React & React Native

let a = 3;

let addFive = (a) => a+5

let b = [1, 2, 3];

if (cond) {

    let message = "Some blocked scope here";

}

let li = [|1, 2, 3|];

let addFive = (a) => {

    let theFive = 5;  

    a+5;

}

 

let result = Array.map(i => i ++ " hamsteriada", arr);

let addFive = (~a=?) => {

    let theFive = 5;

    switch (a) {

        | None => 0

        | Some(a) => a + theFive

    }

}

Js.Global.setTimeout(() => Js.log(addFive(4)), 1000);

 

Js.Promise.(

    Fetch.fetch("https://some-url-here")

    |> then_(Fetch.Response.json)

)

Let's get to coding!

The new Javascript?

By alexb_90

The new Javascript?

  • 601