Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tokeletes(szam){
- if(typeof szam !== "number"){
- return false;
- }
- let sum = 0;
- for(let i = 0;i < szam;i++){
- if(szam%i === 0){
- sum += i;
- }
- }
- if(sum === szam){
- return true;
- }
- else{
- return false;
- }
- }
- class Webbongeszo{
- constructor(memoria = 8192){
- this.lapok = [];
- this.memoria = memoria;
- this._memoriafogyasztas;
- }
- get memoriafogyasztas(){
- return this._memoriafogyasztas;
- }
- set memoriafogyasztas(szam){
- if(szam < 0){
- this._memoriafogyasztas = 0;
- }
- else if(szam > this._memoria){
- this._memoriafogyasztas = this.memoria;
- }
- else{
- this._memoriafogyasztas = szam;
- }
- }
- ujLap(url){
- this.lapok.push(url);
- this.memoriafogyasztas += Math.floor(Math.random()*1100 + 100);
- }
- lapBezar(){
- this.lapok.pop();
- this.memoriafogyasztas -= Math.floor(Math.random()*970 + 30);
- }
- panik(){
- this.lapok = [];
- this.memoriafogyasztas = 10;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement