Skip to content

Instantly share code, notes, and snippets.

@RexSkz
Forked from mutoo/roses-are-red.js
Created August 16, 2019 08:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RexSkz/945fe97e316f427d85e75ba56f8ddf8c to your computer and use it in GitHub Desktop.
Save RexSkz/945fe97e316f427d85e75ba56f8ddf8c to your computer and use it in GitHub Desktop.
Roses are read, violets are blue. Unexpected token { at line 32.
// inspired by https://twitter.com/nixcraft/status/1162020669242003456
console.log('Roses are red, violets are blue.');
try {
eval('function {');
} catch(e) {
let [_, lineno] = e.stack.match(/:(\d+):(\d+)/);
console.error(`${e.message} at line ${lineno}.`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment