Have you ever needed to swap the values of two variables in JavaScript?
While it may seem simple at first, directly swapping the values (head = ta...
For further actions, you may consider blocking this person and/or reporting abuse
Simple and clearly solution for beginners! Nice done Muhmmad.
thanks, ChatGPT told me that wrong with primitive type like number. and [a, b] = [b, a] will not work and it's use jsut for swaping array elemnts . but now you and other told me that. I checked by self and saw that ChatGPT wrong . wow
No temporary variable needed.
thanks, ChatGPT told me that wrong with primitive type like number. and [a, b] = [b, a] will not work and it's use jsut for swaping array elemnts . but now you and other told me that. I checked by self and saw that ChatGPT wrong . wow
ChatGPT is frequently wrong. I'd trust it as far as I could throw it - with programming, and almost anything TBH
You should never do this in real life, but these are great for confusing your colleagues (only works on integers).
👍
😎
🤯
Now here is the real treasure 😉
Great one.
I agree; the only benefit there is saving the memory for 8 bytes or the like. Speed wise it's found lacking.
very good 😀
glad to hear that
The comment section is on fire 🔥.
🔥🔥🔥
Like the effort
thank you
sometimes It's simplified hard lectures. If I didn't understand something I ask his to expalin it for me . but from now on I will careful with every answer I get from him
You are 100% right
Do you like the article or just swap? :)