4
I was always one of those who understood the functions and applied, but I want to understand, why this:
var a = "__myseld=ej232;Nome=Alexandre";
var as = a.split(";");
var x = 0;
while (x<5) {
alert("type of de as(sem match): " + typeof(as[x]));
bs = as[x].match(/a/i);
alert("typeof de bs(match): " + typeof(bs));
if (as[x].match(/nome/i) != null){
alert("achei!: " + as[x]);
x=6;
}
else {
x+=1;
}
}
What moral of a function return an object? Is there a justification for this application? Help me to understand a little this concept of object in javascript, I understand that object is an instance of a class, with this it receives properties of the class that was instantiated in it.. If you want to prescribe a place to read more about it, thank you also!
Well, first of all I recommend reading this W3C article: http://www.w3schools.com/js/js_arrays.asp
– MarceloBoni
To complete Marcelo’s comment. The method
match
returns aArray
(as there can be multiple results). OneArray
is an object.– Anthony Accioly
rsrs, it’s crazy this, an Array is in its essence an object that may or may not contain several other objects of different types.
– MarceloBoni
Good afternoon, did any of the answers solve your problem? If yes please mark it as "Correct". If you do not say what is missing. Thank you.
– Guilherme Nascimento
Yes, there are several questions that I always forget to mark as the best answer.. But I will try to correct this, thank you.
– Ale