I was looking into how to set a variable in javascript and I found out about the Nullish coalescing operator (??) in one of the posts I saw on here.
But now, when I try to use it, I get this error:
Unexpected token, expected ,
for this line:
var oldBookScript = (localStorage.getItem(book.id) ?? newBookScript);
I want the variable oldBookScript to have the value of localStorage.getItem(book.id) but if that is null or empty, I want it to have the value of newBookScript
Do I need to enable it somehow?
Thanks!