When printing a variable, it shows me 5 results that I have obtained from the database.
- General Directorate.
- Administrative Assistant.
- Administration and Human Resources.
- Finance and accounting.
- Advertising and Marketing.
But I would like to know how I can convert these 5 results into a number like so; that is to say, that the console does not print those results to me as such, but rather tells me about them.
CODE
for (var j = 0; j < resultado[i].usuario.areas.length; j++)
{
var areas = resultado[i].usuario.areas[j];
}
Thanks.
What you do is iterate through all the elements. To get the number of all the elements, you can do it through the property
length
:If what you want is that instead of text, get the number that they would occupy, use the control variable: