Skip to content

Instantly share code, notes, and snippets.

@max-mapper
max-mapper / 0.md
Last active February 25, 2024 12:24
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@jeromeetienne
jeromeetienne / multiline.js
Last active June 10, 2019 20:59
a snippet to have multi lines string in javascript.
var multilineString = (function(){ /*
this
is
a
multiline
string.
*/}).toString().split('\n').slice(1, -1).join('\n');
console.log(multilineString);