Answer the question
In order to leave comments, you need to log in
NMAP on the site - how?
Hello. I came across one project ( tyts ).
It became interesting - how they implemented NMAP on their website.
Rummaged Google for API or documentation on the topic Online NMAP, everywhere is empty.
Does anyone know how they managed to do it?
Answer the question
In order to leave comments, you need to log in
class Pizza {
constructor() {
this.crust = prompt('Choose your crust: ');
this.array = new Array(+prompt('How many toppings do you want?')).fill(0);
}
makeTopping() {
this.array = this.array.map(function (t) { return prompt('Choose your topping: ') })
}
makePizza() {
return `Your order is done! You choose ${this.crust} crust with these toppings: ${this.array.join(', ')}`
}
}
let personalPizza = new Pizza();
personalPizza.makeTopping();
alert(personalPizza.makePizza());
class Pizza {
constructor() {
this.crust = prompt('Choose your crust: ');
this.toppingsCount = +prompt('How many toppings do you want?') || 0;
this.toppings = [];
}
makeToppings() {
const {toppings, toppingsCount} = this;
for(let i = toppingsCount; i--;) {
toppings.push(prompt('Choose your topping: '));
}
}
makePizza() {
const {crust, toppings} = this;
return `Your order is done! You choose ${crust} crust with these toppings: ${toppings.length ? toppings.join(', ') : 'nothing'}`;
}
}
let personalPizza = new Pizza();
personalPizza.makeTopping();
console.log(personalPizza.makePizza());
do not use prompt (if this is a real project for real people)
do not use '+' for conversion (if there is no purpose to show off knowledge of clumsy JS)
remove user interaction in the constructor and make a separate method. (if this is a real project for real people)
replace this.toppings
with const toppings
give a array
meaningful name.
Removing the class altogether (optional, if this code is used in this form) console.log
in the last line is meaningless. Either return a value from a function, or call it just like that.
The rest is taste.
parameters are not used, I forgot to remove them from the constructor)
const crust = prompt('Choose your crust: ');
const howMany = +prompt('How many toppings do you want?');
const personalPizza = new Pizza(crust, howMany);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question