i++ vs ++i in JavaScript

preview_player
Показать описание

Thumbnail photo by Crissy Jarvis on Unsplash
Рекомендации по теме
Комментарии
Автор

short, sweet, and helpful video. thanks

Palmtreeshinobi
Автор

Weird! My first thought is "I always want the returned value after the incrementation". But, then again, I always use `i++`. So, I guess it hasn't been an issue for me. Any example where you'd want the "returned value" rather than just referencing the updated value of `i`?

orangemancometh
Автор

Great explanation thanks! Like other I am just wondering what the use case for this is, as I have never encountered an issue using i++ eg. in a for loop. Could you give an example of when you would use ++i ?

yusufelbourki
join shbcf.ru