diff --git a/demo.cola b/demo.cola index 0650190d..c5edf4d6 100644 --- a/demo.cola +++ b/demo.cola @@ -9,18 +9,25 @@ function main(){ console.log("pow:", 5 ** 2, "; modulo:", 5 %% 3, ";"); - var a = 3.14, b = 584; + Number a = 3.14, b = 584, c; a ?= b; console.log(a); a = undefined; a ?= b; console.log(a); + console.log(a = c ? b); + c = 404; + console.log(a = c ? b); + + b = undefined; + console.log("a is {{isset a ? 'set' : 'undefiend'}}, b is {{b?? ? 'set' : 'undefined'}}"); + 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`); - var isEmail = / + RegExp isEmail = / ([\w-\.]+) @ ((?:[\w]+\.)+) diff --git a/lib/index.html b/lib/index.html index ebceaad7..6df33c40 100644 --- a/lib/index.html +++ b/lib/index.html @@ -55,18 +55,25 @@ console.log("pow:", 5 ** 2, "; modulo:", 5 %% 3, ";"); - var a = 3.14, b = 584; + Number a = 3.14, b = 584, c; a ?= b; console.log(a); a = undefined; a ?= b; console.log(a); + console.log(a = c ? b); + c = 404; + console.log(a = c ? b); + + b = undefined; + console.log("a is {{isset a ? 'set' : 'undefiend'}}, b is {{b?? ? 'set' : 'undefined'}}"); + 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`); - var isEmail = / + RegExp isEmail = / ([\w-\.]+) @ ((?:[\w]+\.)+)