Tell us what’s happening:
What is wrong with my step 25 JS function? It console logs the correct values.
const viewCount = (views) => {
if (views >= 1000) {
return `${Math.floor(views / 1000)}k`;
}
return `${views}`;
}
console.log(viewCount(1000))
console.log(viewCount(200))
console.log(viewCount(100000))
Output:
1k
200
100k
I keep getting this error:
Sorry, your code does not pass. Hang in there.
Your viewCount function should return views when views is 200.
Thanks in advance
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const viewCount = (views) => {
if (views >= 1000) {
return `${Math.floor(views / 1000)}k`;
}
return `${views}`;
}
console.log(viewCount(1000))
console.log(viewCount(200))
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Challenge Information:
Learn Asynchronous Programming by Building an fCC Forum Leaderboard - Step 25