Member-only story

JavaScript and Julia Difference in Core Concepts

A discussion of inheritance, string interpolation, null values, iterators and generators

Erik Engheim
9 min readMar 24, 2019

When learning a new language, it is usually very quick to pick up the core stuff like if statements, while loops, variable assignments etc.

I wrote this guide for people who don’t want to spend time with articles which meticulously go through every feature of language you want to learn. If you already know Julia or JavaScript and want to learn the other one, you don’t want plow through obvious stuff. You want to get to the meat.

You already know stuff like inheritance and iterators exist. What you want to know is how they are different in the language you want to learn, compared to the one you know.

I am writing this from a Julia perspective learning JavaScript, but I think JavaScript developers who want to learn Julia better can read this as well.

Defining Types or Classes

Define a type representing a point in Julia:

type Point
x::Int
y::Int
end

julia> p = Point(2, 3)

JavaScript example:

class Point {
constructor (x, y) {
this.x = x
this.y = y
}
}

es6> p = new Point(2, 3)

Class Inheritance

This is an area which is hard to compare, because Julia and JavaScript are entirely…

--

--

Erik Engheim
Erik Engheim

Written by Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

No responses yet