Skip to content

Instantly share code, notes, and snippets.

@meftunca
Last active July 7, 2019 12:57
Show Gist options
  • Save meftunca/c9f546c7d4281387068f11d70d052e8c to your computer and use it in GitHub Desktop.
Save meftunca/c9f546c7d4281387068f11d70d052e8c to your computer and use it in GitHub Desktop.
js Class
class Basic {} // Basic Sınıfını oluşturalı...
const basicClass = new Basic();//Basic Sınıfını çağıralım...
class Basic {
factorial(value) {
let fac = 1;
for (let i = 1; i <= value; i++) fac = fac * i;
return fac;
}
}
let basicClass = new Basic();
let fac = basicClass.factorial(5); //factorial methodunu çağırdık ve 5 parametresini verdik
//Şimdide console.log ile konsoldan çıktı alalım
console.log(fac)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment