JavaScript without HTML in Eclipse

I just want to play a little with JS. I would like to use JS without HTML or HTML page - just a console for output. What is the best way? I have it:

<html>
<body>
<h1>Playin around</h1>
<script type="text/javascript" src="script.js"></script>
</body>
</html>

script.js

var test = "global";

function out() {
    var test = "local";
    return test;
}

window.alert(out());

How can I replace window.alert so that I can get console output and how to do “main” or something else that I don’t need to start with HTML?

thank

+5
source share
5 answers

I am using JS Bin and JS Fiddle .

+4
source

I will stay here. If you need something to easily and quickly check javascript code, here is your path (based on my experience):

, , javascript- eclipse, . * ).

+2

Windows .

Windows Windows 95 script, Javascript Microsoft, JScript, . cmd.exe filename.js, Windows Jscript .

JScript - Javascript, Windows. : JScript COM-; , JScript- Word " " (zip ) , COM-, Windows .

Javascript, , JScript, Windows script Host, , Windows.

, JSLINT, JSHINT CSSHINT - Javascript - , Windows script Host, Windows. , LINT script.

Javascript- WSH, HTML DOM. window , document . Javascript.

WSH:

(function(globalScope){

    var test = "global"; 

    function say(x){ WScript.Echo(x); }

    function out() { 
        var test = "local"; 
        return test; 
    } 

    say(out()); 

}(this));

WScript.Echo - JScript. :

enter image description here

- , JS-:

(function(globalScope){
    'use strict';

    function say(x){ WScript.Echo(x); }

    if (typeof Array.prototype.numericSort !== 'function') {
        Array.prototype.numericSort = function() {
            return this.sort(function(a,b){return a - b;});
        };
    }

    var list = [17,  23, 2003, 39, 9172, 414, 3];

    say("array: [" + list.toString() + "]");

    var sortedList = list.numericSort();

    say("sorted: [" + sortedList.toString() + "]");

}(this));

WSH :

enter image description here

, Array. JS . , , .

+1

- FireBug Firefox, :

console.log(out());
0

javascript html, F12 Chrome, , enter

0

All Articles