JavaScript yield | Sololearn: Learn to code for FREE!
+ 1

JavaScript yield

Knowledge about yield I know using yield in function* but what is const variableName = yield SOMETHING; What's it mean and how to create and use it

17th Mar 2021, 9:50 AM
7n4n03n
7n4n03n - avatar
2 Antworten
+ 2
I am not JavaScript student but found this article.I hope it clear your doubt.If not just ignore it yield - JavaScript | MDN" https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield Thank you­čĄŚ
17th Mar 2021, 10:12 AM
!Derrickee
!Derrickee - avatar
+ 2
at least in javascript, yield is a two way communication with a generator: yield something; return something from generator, waiting for 'next' call to continue execution... var value = yield something; do the same thing, but fill value with the argument passed to 'next' method when called... const fixed_value = yield something; can only be executed once in the generator, as const declare constant variable (meaning you can assign it a value only once) most of the time, you only need to be aware of yield something ;)
17th Mar 2021, 10:57 AM
visph
visph - avatar