1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
var ctverec = "ctverec in global";
var obdelnik = "obdelnik in global";
var a = x / 2/ 5 /6 ;
x = /eeeee/i + 2 / 5
adad = /sdsdsd/
/dfdfdf/
`token ${`nested ${`deeply` + {name: "petr"}.name.toUpperCase()} blah`}`
// nice and simple function
function println(text) {
document.writeln(text + "<br/>");
}
/*
* another nice and simple function
*/
function addSpace(count) {
var space = "";
for(i = 0; i < count; i++) {
space += " ";
}
return space;
}
function Ridic(name, surname){
this.name = name;
this.surname = surname;
this.getName = function() {
return /*this is ugly comment*/this.name;
}
}
function Kolo () {
var ctverec = "ctverect in kolo";
this.trojuhelnik = "trojuhelnik";
this.description = function () {
println(obdelnik);
println("kulate kolo " + // trailing comment
ctverec);
}
}
Kolo.prototype.getColor = function () {
println("Kolo.getColor is called:");
println(addSpace(4) + ctverec);
println(addSpace(4) + this.trojuhelnik);
return "black";
}
Kolo.prototype.isEmpty = function () {
return "is not empty";
}
Ridic.prototype.getSurname = function () {
return this.surname;
}
var motor = {
pocetValcu : 8,
vykon: "22kfdafa",
getDescription: function () {
println ('Pocet valcu: ' + this.pocetValcu + ' s vykonem: ' + this.vykon);
}
}
myKolo = new Kolo();
println("auto");
myKolo.description();
println(myKolo.getColor());
println(myKolo.isEmpty());
myMotor = motor;
myMotor.getDescription();
ridic = new Ridic('Petr', 'Hejl');
println(ridic.getName() + " " + ridic.getSurname());
|