Doug Weaver Doug Weaver - 1 year ago 54
Javascript Question

location.href property vs. location.assign() method

Is there any particular advantage/disadvantage in JavaScript memory consumption between using

location.href = url
as opposed to
location.assign(url)
?

I guess I'm wondering if it takes more memory to access the method as opposed to setting the property.

Answer Source

i always used and never had problems with:

location.href = url;

calling a function should be slightly slower than accessing the property but in terms of memory there should not be a big difference in my humble opinion

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download