Greek symbols for variables in Javascript


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.