This repository was archived by the owner on Oct 23, 2018. It is now read-only.
forked from mishoo/UglifyJS
-
Notifications
You must be signed in to change notification settings - Fork 2
Property accessors
Onoshko Dan edited this page Feb 3, 2015
·
4 revisions
In Cola you have access to elements of array via dot accessor:
console.log([0..10].5) // 5
From Dart was taken cascade accessor
:
document.querySelector("#myelement").style
..fontSize = "16px"
..color = "black"
but ColaScript have some modification:
document.querySelector("#myelement")
..style:
..fontSize = "16px"
..color = "black";
..innerHTML = "Hello World!"
and in ColaScript you can define a function in cascade:
FileReader reader = new FileReader()..onload(loadEvent) {...}
From CoffeeScript was taken prototype accessor
:
Array::forEach.call([0..9], (_) => console.log(_))
String String::replaceAll(a, b) {
String res = this
while res.indexOf(a) != -1 {
res = res.replace(a, b)
}
return res
}
Also from CoffeeScript was taken conditional accessor
:
console.log(someObj?.test()); // undefined
var someObj = {
test: () => "test called"
};
console.log(someObj?.test()) // "test called"