What do you think about a C# 6 like nameof() expression for JavaScript.

Behrang Saeedzadeh behrangsa at gmail.com
Sat Aug 8 00:38:27 UTC 2015

So basically we could use it like this:

function aFunc(aParam) {
    throw new Error(nameof(aParam));

and nameof(aParam) would return the string "aParam".

This is possible to do even right now using arguments.callee and some hacky
code, but having it built-in to spec would be nicer IMHO.
Best regards,
Behrang Saeedzadeh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150808/25ad9b3e/attachment.html>

More information about the es-discuss mailing list