ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# js中的回调函数 ``` <pre class="calibre15">``` var sum <span class="token">=</span> num1 <span class="token">+</span> num2<span class="token1">;</span> <span class="token2">return</span> <span class="token3">callback</span><span class="token1">(</span>sum<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token2">function</span> <span class="token3">squa</span><span class="token1">(</span>num<span class="token1">)</span><span class="token1">{</span> <span class="token2">return</span> num<span class="token">*</span>num<span class="token1">;</span> <span class="token1">}</span> let num <span class="token">=</span> <span class="token3">addSqua</span><span class="token1">(</span><span class="token5">1</span><span class="token1">,</span> <span class="token5">2</span><span class="token1">,</span> squa<span class="token1">)</span><span class="token1">;</span> console<span class="token1">.</span><span class="token3">log</span><span class="token1">(</span>num<span class="token1">)</span><span class="token1">;</span> <span class="token6">//=>9 </span> ``` ```