åå ç« ç¬¬å åãã¸ã§ãã¬ã¼ã¿ãã®ãã¼ã¸ã®æçµæ´æ°æ¥ï¼2019å¹´7æ2æ¥ ä»åã¯ã¸ã§ãã¬ã¼ã¿ï¼generatorï¼ã解説ãã¾ããããã¯ããã£ããè¨ãã¨éä¸ã§æãããã¾ãå ¥ã£ããã§ããé¢æ°ã§ãã ä»ã¾ã§ãé¢æ°ãå®è¡ãããã¨å¿ ããã®é¢æ°ã¯æå¾ã¾ã§ï¼ã¾ãã¯returnæã«ãã©ãçãã¾ã§ï¼å®è¡ããã¾ãããä»åç´¹ä»ããã¸ã§ãã¬ã¼ã¿é¢æ°ï¼generator functionï¼ã使ãã¨ããã§ã¯ãªãé¢æ°ãä½ããã¨ãã§ãã¾ãã function*ã§ã¯ãä¾ãè¦ã¦ã¿ã¾ãããã // ã¸ã§ãã¬ã¼ã¿é¢æ°ãå®ç¾© function* gen(x){ console.log(x); yield; console.log(x*2); yield; console.log(x*3); } var g = gen(10); console.log("1åç®"); g.next(); console.log("2åç®"); g.ne
{{#tags}}- {{label}}
{{/tags}}