r/JavaScriptTips • • Mar 07 '23

Ways to remove falsy values from an array 🧲

Post image
20 Upvotes

14 comments sorted by

2

u/Webex23 Mar 08 '23

Thank you for sharing. It would be greatly appreciated if you could also
provide a link to the code, allowing us to test and modify it
ourselves.

1

u/Low_Mammoth_9371 Mar 09 '23

Check out my earlier comment, I posted the code as text.

1

u/devHaitham Mar 07 '23

Shouldn't it return 'false'?

1

u/Low_Mammoth_9371 Mar 07 '23

Yes, but so that the output is visible in the console when run in the browser, I use console.log() here.

-4

u/[deleted] Mar 07 '23

This is a bot, right? Like, you're feeding ChatGPT prompts and posting the responses directly here.

2

u/Low_Mammoth_9371 Mar 07 '23 edited Mar 07 '23

No, this is all code I've written myself.

I don't actually trust ChatGPT-generated code much and here's why: https://youtu.be/lBDuyXH6zYU

-4

u/[deleted] Mar 07 '23

You misunderstand; ChatGPT could have written this code, and you're providing zero additional value by posting these.

1

u/Low_Mammoth_9371 Mar 07 '23

I have tried ChatGPT and it often gives very wrong answers.

-5

u/[deleted] Mar 07 '23

And yet it gets this simple shit correct. Stop posting this stuff, it's a waste.

0

u/Low_Mammoth_9371 Mar 08 '23

It does sometimes get things correct but you can't fully trust it's answers.

It's therefore not really appropriate for learning and only really useful if you know enough te be able to review the output.

0

u/[deleted] Mar 08 '23

It's absolutely more appropriate for this basic learning than you posting shit, that's for sure.