⭐ Reply with correct answer & Bonus points for explanation ⚡
💡 Correct answer with detailed explanation will be updated in comments after 48 hours.
const numbers = [35, 2, 4, 11, 7];
numbers.sort();
console.log(numbers[2]);
⭐ Reply with correct answer & Bonus points for explanation ⚡
💡 Correct answer with detailed explanation will be updated in comments after 48 hours.
const numbers = [35, 2, 4, 11, 7];
numbers.sort();
console.log(numbers[2]);
For further actions, you may consider blocking this person and/or reporting abuse
Antonio Cardenas -
ng-news -
Sospeter Mong'are -
Juliana Macêdo -
Top comments (6)
sort function is working fine with strings but for numbers it give us a wrong answer and the answer will be like this: [11,2,35,4,7] so numbers[2] = 35
Sure @lukeshiru . I'll make those changes.
Thanks a lot for feedback otherwise I wouldn't have known the issue.
definitely not 7 but do you know what it will log in console ???
Yes thank you🙏🏻
Interesting question, thanks. I thought it would be 7 but then I thought hold up wait a minute something ain't right, can't be that easy.