简体   繁体   English

如何在Chrome开发者工具中调试JavaScript API?

[英]How to debug JavaScript APIs in Chrome dev tool?

I want to step into(egF11) Object.create() and see what is happening internally. 我想进入(egF11)Object.create()看看内部发生了什么。 Is there any way to achieve this in Chrome Dev tools? Chrome开发工具有什么方法可以做到这一点?

var o = {name: 'pat'};
var p = Object.create(o);

Object.create is native code. Object.create是本机代码。 You can't debug it as it's not written in javascript. 您无法调试它,因为它不是用JavaScript编写的。 Wedkit and firefox developers have coded it in C or C++ Wedkit和firefox开发人员已使用C或C ++对其进行了编码

You can debug this code. 您可以调试此代码。 Open Dev Tool in Chrome: 在Chrome中打开开发工具:

Windows: F12 Windows: F12

Mac: ⌘ + Option + i Mac: ⌘+ Option + i

Edit your code and put the "debugger;" 编辑代码并放入“调试器”; before. 之前。

debugger;
var o = {name: 'pat'};
var p = Object.create(o);

Navigate with F11 使用F11导航

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM