Show Menu

Atom.io JavaScript snippets Cheat Sheet by

The default JavaScript snippets in the Atom.io editor
javascript     atom-io

Console

Trig­ger
Cont­ent
log
conso­le.l­og­($1­);$0
warn
conso­le.w­ar­n($­1);$0
error
conso­le.e­rr­or(­$1);$0

Func­tions

f
function ($1) {\n\t$­2\n}
fun
function ${1:fu­nct­ion­_na­me}­(${­2:a­rgu­ment}) {\n\t$­{0:// body...}\n}
iife
(func­tion() {\n\t$­{1:­"use strict­"­;\n­}\t­$2­\n}());

Query

get
getEl­eme­nts­ByT­agN­ame­(${­1:'­${2­:ta­gNa­me}'})
qs
query­Sel­ect­or(­${1­:'$­{2:­que­ry}'})
qsa
query­Sel­ect­orA­ll(­${1­:'$­{2:­que­ry}'})
 

Cond­iti­onals

if
if (${1:t­rue}) {\n\t$­2\n}
else
{\n\t­$1\n}
ife
if (${1:t­rue}) {\n\t$2\n} else {\n\t$­3\n}
switch
switch (${1:e­xpr­ess­ion}) {\n\tcase ${2:ex­pre­ssi­on}­:\n­\t­\t$4­\n­\t\t­bre­ak;­$5­\n\t­def­aul­t:­\n\t­\t$­3\n}

Obje­cts

:
${1:key}: ${2:"${­3:v­alu­e}"}­${4:, }
:f
${1:m­eth­od_­name}: function (${2:a­ttr­ibute}) {\n\t$­3\n­}${­4:,}

Timing Events

interval
setIn­ter­val­(${­2:f­unction () {\n\t$­3\n}}, ${1:10});
timeout
setTi­meo­ut(­${2­:fu­nction () {\n\t$­3\n}}, ${1:10});
 

Loops

do
do {\n\t$2\n} while (${1:t­rue});
for
for (var ${2:i} = 0; ${2:i} < ${1:ar­ray­}.l­ength; ${2:i}++) {\n\t$­{1:­arr­ay}­[${­2:i­}]$­3\n}
while
while (${1:t­rue}) {\n\t$­2\n}
forin
for (${1:v­ari­able} in ${2:ob­ject}) {\n\t$­{5:if (${3:o­bje­ct}.ha­sOw­nPr­ope­rty­(${­4:v­ari­able})) {\n\t­\t$6­\n­\t}}\n}
try
try {\n\t$­{1:­sta­tem­ent­s}\n} catch (${2:v­ari­able}) {\n\t$­{3:­sta­tem­ent­s}­\n}${4: finally {\n\t$­{5:­sta­tem­ent­s}\n}}

Misc

prom
new Promis­e(f­unc­tio­n(r­esolve, reject) {\n\t$­1\n­});$0
proto
${1:cl­ass­_na­me}.pr­oto­typ­e.$­{2:­met­hod­_name} = function (${3:f­irs­t_a­rgu­ment}) {\n\t$­{0:// body...}\n};

Comments

/**
/**/\n $1\n /$0

Download the Atom.io JavaScript snippets Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/stepk_atom-io-javascript-snippets.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          AngularJS Cheat Sheet
          JavaScript Cheat Sheet
          jasmine JS testing Cheat Sheet

          More Cheat Sheets by StepK

          Vim NERDTree Cheat Sheet