const removeFalsyValues = (arr) => {
let truthy = []
for(let i = 0; i < arr.length; i++){
if(arr[i]) {
truthy.push(a...
For further actions, you may consider blocking this person and/or reporting abuse
that's cool, I just wanted to use vanilla js to explain how to write with core vanilla.js :)
I used core vanilla JS
yeah I mean without using in-built function.
i wanted explain people how it actually works behind the scene like the iteration part and all.
Array.push
is a built-in function 🙂bro doens't my code explain in more details, like how its works and different approach :D
For the pedant in me, the function provided does not filter out falsy values from an array, instead it returns a new array that includes only the non-falsy values from the source array. The original array is unmodified.
A function which actually filters out the falsy values from an array would be:
cool thanks for the answer, everyone has different approach. :P
It seems like output of ChatGPT.
And can do it way simpler
On the left, click 3 dots, and "Report abuse".
Why bro, why do you think it's chatgpt output, i tried with core vanilla.js, because i wanted to. everyone has different approaches :)
"The return false value may indicate that I haven't run any tests."
Const check=(gettting)=>{
First.filter((ele)=>{
Ele===false })
}
Let first=[1,2,3,4,0,false ]
check(first)