Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Roses are read, violets are blue. Unexpected token { at line 32.
// inspired by
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