From JavaScript?

The following tables show side-by-side mappings between JavaScript and Elm. A lot of things are very similar, especially once you get used to the relatively minor syntactic difference.

Literals

JavaScriptElm
33
3.14153.1415
"Hello world!""Hello world!"
Multiline strings not widely supported"""multiline string"""
'Hello world!'Cannot use single quotes for strings
No distinction between characters and strings'a'
trueTrue
falseFalse
[1,2,3][1,2,3]

Objects / Records

JavaScriptElm
{ x: 3, y: 4 }{ x = 3, y = 4 }
point.xpoint.x
point.x = 42{ point | x = 42 }

Functions

JavaScriptElm
function(x,y) { return x + y; }\x y -> x + y
Math.max(3, 4)max 3 4
Math.min(1, Math.pow(2, 4))min 1 (2^4)
numbers.map(Math.sqrt)List.map sqrt numbers
points.map(function(p) { return p.x })List.map .x points

Control Flow

JavaScriptElm
3 > 2 ? 'cat' : 'dog'if 3 > 2 then "cat" else "dog"
var x = 42; ...let x = 42 in ...
return 42Everything is an expression, no need for return

Strings

JavaScriptElm
'abc' + '123'"abc" ++ "123"
'abc'.lengthString.length "abc"
'abc'.toUpperCase()String.toUpper "abc"
'abc' + 123"abc" ++ toString 123