javascript - JSFiddle.net Am I using this correctly? - Stack Overflow

I put this code in the JavaScript box on www.jsfiddle and hit "run," but nothing happened. It

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 0
Add a ment  | 

4 Answers 4

Reset to default 3

Well, 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 :).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745291932a4620911.html

相关推荐

  • javascript - JSFiddle.net Am I using this correctly? - Stack Overflow

    I put this code in the JavaScript box on www.jsfiddle and hit "run," but nothing happened. It

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信