8. Array Length Chart.js

Array Length Chart.js

The array length method can be useful for certain moments in Chart.js. Using this method on it’s own is not considered very useful.

The main reason to use this is commonly in a for loop where we loop through the data and add or remove specific items as we need the index number. However know what it does is essential. The video covers how to use the array length method.

Array Length Chart.js

How to use the array length method?

The code below shows you how to measure the length of an array. Doing this is useful if we need to know the amount of elements in the array.

const chartjs = ['bar', 'pie', 'line'];
chartjs.length; // 3

Was this page helpful?

Leave a comment

Your email address will not be published.