Hacker News new | past | comments | ask | show | jobs | submit login
Dealing with JavaScript's Automatic Semicolon Insertion (pocoo.org)
3 points by niyazpk on Oct 23, 2012 | hide | past | favorite | 1 comment



-"But to save yourself time and troubles, just place them all the time"- Or to save even more time, just put semicolons before raw expressions (not very common at all) and omit them everywhere else. ASI is a feature not a problem like many people make it look like. A good informative article nonetheless.

  ;(function(){}()) // Common IIFE
  'use strict'; // need semicolon here

  // Not very common without an assignment
  ;'string'.method()
  ;[0,1,2,3].method()
  ;/regex/.method()




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: