Object property constants in ECMAScript?
-
29-10-2019 - |
문제
I've seen some proposals for ECMAScript Harmony in terms of being able to specify constants with the keyword const
. However, it seems to be only available in block scopes (i.e., FunctionBody
and Program
). Is there a way to define constants as an object property (imagine myObj.STATUS_OK
)?
I guess the suggested way is to use properties
via Object.definePropert(y/ies)
, but that does not seem very convenient, now is it?
올바른 솔루션이 없습니다
제휴하지 않습니다 StackOverflow