Can we define cubes with JavaScript instead of YAML?

Yes! You can define data models using javascript .cube.js files