Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Is it possible to define Classes in JavaScript when using CopperCube? Everytime i try to define a class i get the Syntax-Error "missing ; before statement". Or maybe Im just defining classes wrong idk. class Test { |
||||
|
Ok nevermind ES5 just found out doesnt support classes lol. |
||||
|
AGBdev wrote: Ok nevermind ES5 just found out doesnt support classes lol. *Ok nevermind just found out that JavaScript ES5 doesnt support classes lol. |
||||
|
can use function as class ! function myFunc(parameters) { // etc etc }; var myVar = new myFunc(parameters); my var now separate instance of myfunc |
||||
|
AGBdev, you don't use Class in CC's JavaScript. |
||||
|
Tip: 3 ways to define a JavaScript class September 29th, 2006. Tagged: JavaScript My Tag: Coppercube https://www.phpied.com/3-ways-to-define-a-javascript-class/ function Apple (type) { this.type = type; this.color = "red"; } Apple.prototype.getInfo = function() { print("this color="+ this.color + '"\n type=" + this.type ); }; |
|