Sorry, this may be an easy one, but it has me stumped. I’m trying to loop over this array and log out each value, but the script is logging out a string object.
propertiesToSanitize = ["title", "description", "place_name"]
$.each propertiesToSanitize, ->
console.log this
which converts to jQuery as
var propertiesToSanitize;
propertiesToSanitize = ["title", "description", "place_name"];
$.each(propertiesToSanitize, function() {
return console.log(this);
});
is returning:
String
0: "t"
1: "i"
2: "t"
3: "l"
4: "e"
length: 5
Any idea why it’s returning this instead of just “title” or any other value? Thanks in advance for any help.
the index and the value for each iteration are provided as a parameter in the callback.