piece of code today. Do you think I should leave the place without saying goodbye?
Lol
Who the hell wrote it
Unfortunately can't say
if the person that wrote it is still there and is your boss, then i have sad news, you going to become bald
I prefer lost the employee that becoming bald xD
sooo... what's the issue?
you meaybe?
DRYless
to check if localStorage is available
So the code is wrong
how so?
I think this is more readable than ternary stuff
to check if localStorage is available you can make a boolean and not create a variable with same name! isMounted? isLocalStorageExist?
so everytime you want to call it you do if (isLocalStorageExist) { window.localStorage.... } `
The problem here is that localStorage would be undefined unless that case is handled after that line. Using an if condition isn't wrong, but I would prefer ternary.
Обсуждают сегодня