Frank Phillips
Frank Phillips

Reputation: 95

What are the limitations of localstorage keys?

When I query localStorage.feature7f1c3c10-048d-4ced-8ab8-b88ac91b59ee in an inspector console I receive the below.

SyntaxError: At least one digit must occur after a decimal point line: 515 message: "At least one digit must occur after a decimal point" stack: "eval@[native code]↵evaluate@[native code]↵_evaluateOn↵_evaluateAndWrap↵evaluate"

Simple question is why?

Upvotes: 2

Views: 2043

Answers (1)

Alexander Presber
Alexander Presber

Reputation: 6625

The '-' is illegal in keys in dot notation. You will see that

localStorage['feature7f1c3c10-048d-4ced-8ab8-b88ac91b59ee']

is valid.

More on valid JS identifiers (that can be used as keys without quotes) here.

Upvotes: 7

Related Questions