我试图在IE中调试我的JavaScript,但我不知道从哪里开始.有谁能够帮我?我认为这只是一个小错误,但开发人员工具有点无用.
unexpected identifier当你去http://songtagapp.com/时出现错误.我认为这与我用于RequireJS 的tpl!插件有关,但这就是我所能说的.
我在这个视频中设置了coffeescript文件观察器
http://www.youtube.com/watch?v=Sl1Uk3zT5Fg
对于使用谷歌浏览器调试的html项目,这似乎工作得很好.但是,当我开始调试并在node.js项目中的coffeescript文件中设置断点时,它不会遇到断点.但是,在生成的js文件中设置断点会受到影响.
我需要做什么才能使调试器使用生成的源映射并在webstorm 6中使用node.js逐步执行coffeescript?
我来自Java Background,因此习惯使用Eclipse进行调试,但最近开始使用JavaScript(特别是jQuery)并且我很难调试JavaScript代码所以我的问题是
调试JavaScript的最佳方法是什么?
我尝试过使用Firebug并且很好,但想知道
如果我们有调试JavaScript的任何其他有用的工具或策略?
上下文
我正在尝试实现一个功能,以便当用户单击表中的复选框时,该属性value和data-title复选框应存储在名为selected新键 - 值对数组元素的JS对象文字中.
如果用户在同一个复选框上再次单击,则应删除相应的数组元素.
问题
第一次单击复选框时,selected将按对象在对象中创建数组.
但是,当第二次单击相同的复选框时,不会删除相应的数组,而是添加一个新的(重复的).
码
var selected = {items:[]};
$('#table').on('click', 'input[type="checkbox"]', function() {
var found = false;
$.each(selected.items, function(i, val) {
if (val.key == $(this).attr("value")) {
selected.items.splice(i ,1);
found = true;
return false; //step out of each()
}
});
if (found == false) {
selected.items.push({key: $(this).attr("value"), value: $(this).attr("data-title")});
}
console.log(selected);
});
Run Code Online (Sandbox Code Playgroud) 一般我知道如何设置断点,检查变量,步入函数等...
Default.htm由数百个脚本组成,为空 占位符.
理想情况下,我想一步一步地进行.在第一行中设置断点不起作用:

当我跳过下一个函数调用时,它已经很久了(一切都已加载).

一般如何调试异步加载脚本?(时间线清楚地表明它们同时加载)
也许我应该使用像Fiddler这样的HTTP代理?我知道如何设置简单断点(BPU)然后呢?

换句话说 - 哪种方法 - 如何调试我的JavaScript代码? - 根据我的需求量身定制?
我正在尝试在浏览器中调试一些js(专门用于Chrome).如何查看为some_data和new_data设置的值?
我意识到由于变量范围仅限于函数,some_data并且new_data在执行文件ready()之后不存在.
$(document).ready(function(){
var some_data = [4, 8, 15, 16, 23, 42];
var new_data = some_data * 2;
});
Run Code Online (Sandbox Code Playgroud) 我有一个带有 Tic Tac Toe 字段的 HTML。随着几个onlick的
HTML (game.html):
<table class="nes-table is-bordered is-centered" id="tttpattern">
<tbody>
<tr>
<td class="square" id="0.0" onclick="gameController.putScore('0.0')"></td>
<td class="square" id="0.1" onclick="gameController.putScore('0.1')"></td>
<td class="square" id="0.2" onclick="gameController.putScore('0.2')"></td>
</tr>
<tr>
<td class="square" id="1.0" onclick="gameController.putScore('1.0')"></td>
<td class="square" id="1.1" onclick="gameController.putScore('1.1')"></td>
<td class="square" id="1.2" onclick="gameController.putScore('1.2')"></td>
</tr>
<tr>
<td class="square" id="2.0" onclick="gameController.putScore('2.0')"></td>
<td class="square" id="2.1" onclick="gameController.putScore('2.1')"></td>
<td class="square" id="2.2" onclick="gameController.putScore('2.2')"></td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
当我单击其中之一时onclick,我的代码会putScore在我的gameController.js.
在这个 js 中,我想检查user_id在 my 中使用payload的player1ID 是否与我从数据库中获得的ID相同。
如果是这种情况,我的程序应该在我单击的方块中写一个 …
我想遍历对象数组,这在我的json文件中。
杰森
[
{
"name": "Mike",
"colors": [
{"name": "blue"},
{"name": "white"}
]
},
{
"name": "Phoebe",
"colors": [
{"name": "red"},
{"name": "yellow"}
]
}
]
Run Code Online (Sandbox Code Playgroud)
html
<div *ngFor="let person of persons">
<p>{{person.name}}</p> <!-- this works fine-->
<p *ngFor="let color of person.colors"> <!--I want to list the colors of the person here-->
{{color.name}}
</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我无法访问一个人的颜色数组。我该如何实现?
我已经看过这些帖子,但是它们的解决方案无法帮助我:
因此,我正在查看一些 SO 问题和 jQuery 区域,以尝试在 PHP 中使用类似的功能,使用explode它只会将给定的字符串从一种类型的子字符串分解为它的片段。
这是我使用的代码:
var users = // AJAX CALL TO GET USERS
var usersArr = users.split();
Run Code Online (Sandbox Code Playgroud)
我查看w3了拆分字符串的教程,这是 JavaScript 类型,即使这样也不起作用。
错误信息:
index.js:45 Uncaught TypeError: users.split 不是函数
我希望有一个独立的editor和debugger,基本上是一个IDE为JavaScript。我目前只使用命令行运行独立的脚本和编辑它们的混合Notepad++,有时Scratchpad是进来Firefox Developer tools。
但是Debugger中Firefox Developer Tools没有显示我的来源ScratchPad。我该如何向他们展示?
此外,我无法在ScratchPad编辑器中设置断点。