2014-04-19 18:04:11 +00:00
|
|
|
main(){
|
2014-04-16 16:43:40 +00:00
|
|
|
console.log(`
|
|
|
|
|
|
|
|
|
|
Hello!
|
|
|
|
|
My name is ColaScript, and i know who you are }:->
|
|
|
|
|
@{navigator.userAgent}
|
|
|
|
|
|
|
|
|
|
`);
|
|
|
|
|
|
|
|
|
|
console.log("pow:", 5 ** 2, "; modulo:", 5 %% 3, ";");
|
|
|
|
|
|
2014-04-18 18:33:08 +00:00
|
|
|
Number a = 3.14, b = 584, c;
|
2014-04-16 16:43:40 +00:00
|
|
|
|
|
|
|
|
a ?= b; console.log(a);
|
|
|
|
|
a = undefined;
|
|
|
|
|
a ?= b; console.log(a);
|
|
|
|
|
|
2014-04-18 18:33:08 +00:00
|
|
|
console.log(a = c ? b);
|
|
|
|
|
c = 404;
|
|
|
|
|
console.log(a = c ? b);
|
|
|
|
|
|
|
|
|
|
b = undefined;
|
2014-04-20 07:31:03 +00:00
|
|
|
|
|
|
|
|
Array x, y;
|
|
|
|
|
x = [123];
|
|
|
|
|
y = clone x;
|
2014-04-20 18:56:47 +00:00
|
|
|
y[] = 321;
|
|
|
|
|
console.log('original:',x,'cloned:',y, y[]);
|
2014-04-20 07:31:03 +00:00
|
|
|
|
2014-04-20 18:56:47 +00:00
|
|
|
y.forEach((val) => console.log(val));
|
2014-04-20 07:31:03 +00:00
|
|
|
|
2014-04-18 18:33:08 +00:00
|
|
|
console.log("a is {{isset a ? 'set' : 'undefiend'}}, b is {{b?? ? 'set' : 'undefined'}}");
|
|
|
|
|
|
2014-04-16 16:43:40 +00:00
|
|
|
console.log(`is:`, location.href is String, `; isnt:`, 123 isnt Number, ";");
|
|
|
|
|
|
|
|
|
|
if(yes === true && on === true && no === false && off === false) console.log('Boolean alternatives');
|
|
|
|
|
|
|
|
|
|
console.log('Raw string:', r`@test \n \t \r`);
|
2014-04-18 18:33:08 +00:00
|
|
|
RegExp isEmail = /
|
2014-04-16 16:43:40 +00:00
|
|
|
([\w-\.]+)
|
|
|
|
|
@
|
|
|
|
|
((?:[\w]+\.)+)
|
|
|
|
|
([a-zA-Z]{2,4})
|
|
|
|
|
/, email = r'danon0404@gmail.com';
|
|
|
|
|
console.log("@email is email:", isEmail.test(email));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main();
|