Rekursi dalam fungsi kelas
class Person
{
constructor(name)
{
this.name = name;
this.run();
}
run()
{
console.log('hello world');
var i = Math.floor(Math.random()*7);
while(i !=5)
{
return this.run();
/*notice to use recursion, you have to return this.run()*/
}
}
}
function summon()
{
let p = new Person("hello");
}
Javasper