diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index fc845fa..9a98add 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -52,13 +52,13 @@ snippet case ${3} # for (...) {...} snippet for - for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3: += 1}) { - ${4:$1[$2]} + for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) { + var ${3:v} = $1[$2];${4:} } # for (...) {...} (Improved Native For-Loop) snippet forr - for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3: -= 1}) { - ${4:$1[$2]} + for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) { + var ${3:v} = $1[$2];${4:} } # while (...) {...} snippet wh