// declarations
var name = "GiavaScript"
var version = "runtime"
// non-standard notes
if (typeof name === "string") {
console.log(`${name} ${version}`)
}
A pragmatic JavaScript runtime
GiavaScript runs JavaScript with intentional non-standard differences. Keep JavaScript's familiar feel while running on a runtime built with Crystal internals and practical JS ergonomics.
// arrays + callbacks
var nums = [1, 2, 3, 4, 5]
var even = nums.filter(function(n) {
return n % 2 === 0
})
var json = JSON.stringify(even)
console.log(json)
// control flow and Math
function powerScore(base, exp) {
return Math.pow(base, exp)
}
var score = powerScore(2, 8)
if (score === 256) {
console.log("GS runtime ready")
}