how to write javascript code code example
Example 1: js code
var emotion = "happy";
var time = 1614;
var name = "Ruby";
var day = "morning";
if ( time < 1200 ) {
day = "morning";
};
else if ( time < 600 || time > 2200 ) {
day = "night";
};
else {
day = "afternoon";
};
console.log("at " + time + "at " + day + ". " + name + "was felling quite" + emotion + ".");
Example 2: javascript code
function getIntoAnArgument() {
var args = arguments.slice();
args.forEach(function(arg) {
console.log(arg);
});
}
Example 3: how to write in js
document.write("put your text here!");