What is the use of truthy and falsy? and The below code is too confusing for me...I'm a begineer and just enrolled my Java script course with Mosh

const array = [0, null, ‘’, 2, 3];


function countTruthy(array) {

let count = 0;

for (let value of array)

    if (value)


return count;


Read this.

Understanding Javascript Truthy and Falsey

1 Like