admin管理员组文章数量:1418593
I put this code in the JavaScript box on www.jsfiddle and hit "run," but nothing happened. It works fine when I test it in Firebug, so why not jsfiddle Am I using jsfiddle incorrectly?
String.prototype.reverse = function() {
return Array.prototype.reverse.apply(this.split('')).join('');
}
"box".reverse();
Here I'm trying to save a fiddle. I click run and it doesn't work.
/
I put this code in the JavaScript box on www.jsfiddle and hit "run," but nothing happened. It works fine when I test it in Firebug, so why not jsfiddle Am I using jsfiddle incorrectly?
String.prototype.reverse = function() {
return Array.prototype.reverse.apply(this.split('')).join('');
}
"box".reverse();
Here I'm trying to save a fiddle. I click run and it doesn't work.
http://jsfiddle/mjmitche/qnjP3/
Share Improve this question edited Mar 21, 2011 at 11:49 Leahcim asked Mar 21, 2011 at 11:44 LeahcimLeahcim 42.2k61 gold badges203 silver badges344 bronze badges 04 Answers
Reset to default 3Well, try alert("box".reverse())
; Your code did work, there was nothing to show it. See this fiddle
Works fine for me : http://jsfiddle/jomanlk/Vp5SF/
You probably didn't put an alert around your string. Since right now your method only returns the string so you don't have any indication that anything is happening.
Well, you have to create some output, don't you?
jsfiddle is not a JavaScript console. Either append the output do the DOM or print it to the browser's console.
jsfiddle lets you create a website with HTML, JavaScript and CSS on the fly, but nothing more. If you put your code above in a basic HTML file and open it with your browser, you would not see any output either.
It might be helpful to read the documentation.
Being a bit green with JS, I had the same notion about JSFiddle ...
Here's a tool that suits a bit better for that IMO ... jsbin. (I took the liberty of putting your code in the above example).
The benefit is that you can use console in jsbin :).
本文标签: javascriptJSFiddlenet Am I using this correctlyStack Overflow
版权声明:本文标题:javascript - JSFiddle.net Am I using this correctly? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745291932a2651847.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论