Every time when a function run it will be push into the call stack and put on the top,  you can think call stack is something like a heap... Javascirpt has only one call stack.

In the picture, main() get call first, so put into the call stack;

second, printSquare(), put into the call stack;

third, inside printSquare() call suqare() function, so put into call stack;

fourth, inside square() function, multiply() function get call....

--------------------------

When function return or done, the function will be poped up from the call stack:

So, multiply() function ruturned, so pop up from the call stack;

then square();

then inside printSquare() function, console.log() funciton get call, so need to push intot the call stack.

After that, console.log() pop up;

printSquare() pop up;

finally main() pop up;

You can see the call stack from the Chrome dev tool's source tab when you use 'debugger'.

[Javascript] Call Stack的更多相关文章

  1. JavaScript 查看stack trace

    How can I get a JavaScript stack trace when I throw an exception? Edit 2 (2017): In all modern brows ...

  2. 使用javascript的stack数据结构,实现进制转换

    function Stack() { var items = []; this.push = function(element){ items.push(element); } this.pop = ...

  3. JavaScript-关于在IE下JavaScript的Stack overflow at line错误可能的原因

    1.注册表混乱使基于IE内核的浏览器无法正常显示图片尤其是png格式, 修改一下注册表(网上搜) 2.重定义了系统的触发事件名称作为自定义函数名如: onclick / onsubmit…  都是系统 ...

  4. 关于在IE下JavaScript的 Stack overflow at line 错误可能的原因

    该错误只在IE中出现,出现该提示的原因主要有两种: 1. 重定义了系统的触发事件名称作为自定义函数名如:  onclick / onsubmit …  都是系统保留的事件名称,不允许作为重定义函数名称 ...

  5. 每个JavaScript工程师都应懂的33个概念

    摘要: 基础很重要啊! 原文:33 concepts every JavaScript developer should know 译文:每个 JavaScript 工程师都应懂的33个概念 作者:s ...

  6. 每个 JavaScript 工程师都应懂的33个概念

    简介 这个项目是为了帮助开发者掌握 JavaScript 概念而创立的.它不是必备,但在未来学习(JavaScript)中,可以作为一篇指南. 本篇文章是参照 @leonardomso 创立,英文版项 ...

  7. [Algorithms] Build a Binary Tree in JavaScript and Several Traversal Algorithms

    A binary tree is a tree where each node may only have up to two children. These children are stored ...

  8. JavaScript中常见数据结构

    数据结构 栈:一种遵从先进后出 (LIFO) 原则的有序集合:新添加的或待删除的元素都保存在栈的末尾,称作栈顶,另一端为栈底.在栈里,新元素都靠近栈顶,旧元素都接近栈底. 队列:与上相反,一种遵循先进 ...

  9. weui 多网页切换效果分析

    weui的文档写的不怎么详尽,简单的来讲WeUI 为微信 Web 服务量身设计的h5框架. WeUI是一套同微信原生视觉体验一致的基础样式库,由微信官方设计团队为微信 Web 开发量身设计,可以令用户 ...

随机推荐

  1. Android getResources的作用和须要注意点

    今天做一个Android的文件管理器,里面用到非常多的地方用到了getResources. Drawable currentIcon = null; currentIcon = getResource ...

  2. mongo export import

    mongoexport -h 127.0.0.1 -p 27170 -d dbs -c table -f field1,field2,field3 -q condition 路径.名称 mongoim ...

  3. springmvc的讲解

    概述 继 Spring 2.0 对 Spring MVC 进行重大升级后,Spring 2.5 又为 Spring MVC 引入了注解驱动功能.现在你无须让 Controller 继承任何接口,无需在 ...

  4. 关于textbox.attributes["value"]的问题

    在“修改”时,出现这个问题,后台点击修改时,应该是文本框出现一些初始值 BLL.manager bll = new BLL.manager(); Model.manager model = bll.G ...

  5. SQL Server 如何创建定时作业

    在做SQL server 管理时,往往需要每日执行定时任务,但是如果每天都去人工执行,非常不方便,而且一般定时操作,都应该是在数据库压力不大时,一般是在夜间.所以我们需要创建定时作业来代替人工的执行定 ...

  6. Android开发性能优化大总结(二)

    接上篇: 1.在JAVA+Oracle 的应用系统开发中,Java中内嵌的sql语句尽量使用大写的形式,以减少Oracle解析器的解析负担: 2.由于JVM的有其自身的GC机制,但是也有遗漏的隐患,建 ...

  7. 导入IP安全策略图解

    导入IP安全策略图解 点击“开始菜单”→点击“运行”→输入gpedit.msc并回车 →点击“计算机配置”→“windows设置”→“安全设置”,用鼠标右键点击“IP安全策略”,在弹出菜单中点击“所有 ...

  8. jQuery读取JSON总结

    1.jQuery 部分 <script src="js/jquery.js" type="text/javascript"></script& ...

  9. MySQL 查询结果保存为CSV文件

    MySQL支持将查询结果直接导出为文本格式,格式如下: into outfile '导出的目录和文件名'                  指定导出的目录和文件名 fields terminated ...

  10. Membership添加验证码登录

    1.在公共类ImageHelper中编写公共方法,产生随机验证码 /// <summary> /// 产生随机验证码 /// </summary> /// <return ...