Greek symbols for variables in Javascript

This entry is part 1 of 2 in the series TIL
Hey. This page is more than 3 years old! The content here is probably outdated, so bear that in mind. If this post is part of a series, there may be a more recent post that supersedes this one.

For my inaugural TIL series…

Today I Learnt that you can use Greek symbols for variables in Javascript.

This was a feature I really liked about Julia. I have been working on a maths heavy javascript-coded project and had been using ALPHA for α and deltaH for ΔH, eg:

const ALPHA = 0.5; 
let deltaH = 0.02;
let x = ALPHA * deltaH ;

It turns out that javascript is as happy with;

const α = 0.5; 
let ΔH = 0.02;
let x = α * ΔH;

or even;

More info

Better reading elsewhere (here).

Eggplants and peaches. Open to debate, not here though.

Anyway, as of ECMAScript 5, you can use any character from Unicode 6.1. ECMAScript is now on v12 so I am sure it has been extended.

Series navigation

Quick and dirty removing components from trash PCBs >>