[Solved] How can I solve this String length problem?


Have you tried calculating the length within the function rather than in the console log? This ensures that all of the logic is first completed within the function before it is returned in the console log. Your function expects the string name, but you are passing name.length

function getNameLength(name){
    return name.length;
}

console.log(getNameLength('John'));
console.log(getNameLength('Argentina!'));
console.log(getNameLength('Macedonia'));

1

solved How can I solve this String length problem?