Skip to content

Category: Questions

Is localstorage data encryption necessary?

I am making an add to cart system first time and instead of using php , I am using javascript i.e in client side. will it be safe ?? or if it is not, then what should I do to secure the data in localstorge? Answer Yes, it might be, in your case. As users might be able to manipulate

How to use “for” along with string replace?

I want to make several replacements in the same string. I have this: after the replacements it should look like this: So I tried: but it doesnt seem to do anything. What is wrong? Answer The way you wrote it now, it will only replace on the last id and assign it to the mylist variable, because .replace does n…

Making flexible piece of text for a couple of objects

I have 2 objects, vehicle1 and vehicle2 objects, for vehicle1 I have a leaflet popup: I’d like to do the same with vehicle2, just to swap between objects, so I want something like that: But I don’t want to repeat code like this. I tried putting it into the object with ‘this’ keyword, b…