Coming back to JavaScript from Crystal

Hi everyone,

For quite some time I’ve been programming in a language called Crystal it’s basically strongly typed and compiled Ruby. After doing some work in JavaScript I noticed I missed having compiler errors and easily predictable data types (e.g. strongly typed). I’ve been checking out TypeScript and it looks like it may address some of the isues I see coming back.

To provide some further context on this situation, Crystal lacks enterprise adoption (probably for several more years as it needs Windows Support badly) so I still need JavaScript and C# as “business skills” there are not any businesses in my area building web apps using Crystal, it’s all JavaScript(TypeScript), C#, Ruby, or PHP here. It’s of course a nice selection of lanuages so not gonna complain but going back to JavaScript/TypeScript means I’ll need to do some refreshing of course.

What tips does the freeCodeCamp Community have on coming back to JavaScript after using a compiled language and missing some of the benefits they offer?

Cordially,
Nathaniel :slight_smile:

Hi Nsuchy,
Nothing in the curriculum. Haven’t searched articles or videos though. I was going to learn typescript after I learned JS for the same reason. It looks like it’s:

  • use let and const not var

  • avoid global scope

       and
    
  • === for equivalence

for us. :smile:
Here’s Crockford’s sequel to JS The Good Parts, if you like him:
https://youtu.be/8oGCyfautKo

You can set up a linter like eslint with some default presets to throw you some warnings about what’s considered “best practice”.

Alternatively you can consider adding flow to your project(s).
Flow is an OS project developed by Facebook that aims to add static type checking to JS.

And finally, as you said, you can’t really go wrong with TypeScript :slight_smile:


Personal note, I see you have an elixir alchemist banner, so I can assume you like functional programming languages…

Have you looked at https://reasonml.github.io/ ?

Again a Facebook OS project that compiles OCaml to JS.
It’s not JS tho, it’s a totally different language :wink:

1 Like