Which is more memory efficient in JavaScript: big arrays, or big strings with a comma separator?

I am working with big arrays, bug I want to know if I can compress it’s content to be more memory effectiant, I am using:

mybigarray.includes(x)

and was wondering if it woild be more efficient to just do

mybigstring.includes(String(x))

would be slightly more effecient.

Q: Are Strings more memory effecient than Arrays? => if not, is there any way to compress an Array to save memory?



Thanks!
Cheers!

Leave a Reply

Your email address will not be published.