Skip to content Skip to sidebar Skip to footer

How To Display The Array Length In Console With Javascript/angularjs

I have a question about displaying the Array length in console.log(). Here is a simple example: vm.list = CrudService.getAllData(); function getAllFonds() { return ResService.n

Solution 1:

Sure there is

console.log(yourArray.length);

Or if you insist on that format you can do

console.log('Array['+yourArray.length+']');

Take a peek at the docs

Solution 2:

I think you're looking for this:

console.log(vm.list.length);

or in your case

$log.info(vm.list.length);

Post a Comment for "How To Display The Array Length In Console With Javascript/angularjs"