把 Groovy 代碼轉換成:JavaScript Grooscript
Grooscript 可以把 Groovy 代碼轉換成 JavaScript 代碼 (Groovy 2.x to Javascript ECMAScript 5)。
在線轉換:http://grooscript.org/conversions.html
示例:
//List
def max = [1, 3, 8].collect { it * 2 }.max()
println "Maximum double is: $max"
assert max == 16
//Traits example
trait FlyingAbility {
String fly() { "I'm flying!" }
}
class Bird implements FlyingAbility {}
def b = new Bird()
println b.fly()
assert b.fly() == "I'm flying!" 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!