Question from the Javascript - Fundamentals test

Write a unit test for the getSize() function in Javascript

Medium

What is the interest of the IF block?

function getSize(tab) { 
    return tab.length; 
} 
const list = ['rice', 'quinoa', 'semolina', 'milk']; 
if (getSize(list)!= 4) { 
    console.error('error');
 } 
Author: KahinaStatus: Published(Update)Question passed 536 times
Edit
-1
Community Evaluations
developer avatar
Incorrect answer
Dylan Pellé
05/09/2024
Si ça c'est un test unitaire alors je suis un écureuil !