hunterzzpro hunterzzpro - 6 months ago 8x
Javascript Question

object with array type string causing a typeError

The best way to explain this is just to show you.

var condition = 70;
var formnames = new Array("wheelcheckbox1", "wheelcheckbox2","spokecheckbox","spokecheckbox2","tirecheckbox","tirecheckbox2","tirecheckbox3");

formnames.forEach(function(entry) {
if(obj.entry == "") {
condition = condition - 10;

as you can see i used the console log to show how it needs to work
as that works perfect, however using the array causes an error as
they're strings and not what the obj wants, it wants text without it being a string if you get what i mean, any ideas?

Answer should not be used to iterate over an array. Consider using forEach instead.