goit-js-hw-01 repository was createdtask-номер_завдання.js Use <script type="module"> to close the task code in a separate scope and avoid conflicts of identifier names.name and price'Обрано «Генератор захисного поля», ціна за штуку 1000 кредитів' .'Обрано «Генератор захисного поля», ціна за штуку 2000 кредитів' . Write a script for checking the quantity of goods in the warehouse. There are variables total (the number of goods in stock) and ordered (units of goods in order).
Compare these values and the results of the output:
"На складі недостатньо товарів!" ."Замовлення оформлено, з вами зв'яжеться менеджер" . Check the performance of the code with different values of variable ordered , such as 20 , 80 and 130 .
const total = 100 ;
const ordered = 50 ;Write a script that simulates the administrator's authorization in the control panel.
There is a variable message in which the result message will be recorded. When you download the page from the visitor, the password is requested through prompt :
Cancel , write down in message a line 'Скасовано користувачем!'ADMIN_PASSWORD constant, write down in message line 'Ласкаво просимо!'message 'Доступ заборонений, невірний пароль!'message variable value in alert . const ADMIN_PASSWORD = "jqueryismyjam" ;
let message ; The user's account has 23580 loans, the value is stored in credits variable (creation and appropriation). The user decides to buy repair droid, which cost 3000 credits apiece. The price of one droid is stored in the variable pricePerDroid .
When visiting the page using prompt , you need to ask the number of droids that the user wants to buy and keep in the variable.
Write a script which one:
Cancel button was pressed in prompt , the message is displayed in the 'Скасовано користувачем!' .totalPrice variable.'Недостатньо коштів на рахунку!' .'Ви купили [число] дроїдів, на рахунку залишилося [число] кредитів.' . The user can arrange the delivery of the goods to his country by specifying it when you visit the page in prompt . Keep in, the user can enter the country's name not only lower -case letters, but for 'кИтАЙ' .
Write a script that outputs the shipping value to the country. Be sure to use switch . Message format: 'Доставка в [країна] буде коштувати [ціна] кредитів' .
But delivery is not everywhere, if the country is not in the list, then delete in alert Message 'У вашій країні доставка недоступна' .
Below is a list of countries and shipping costs.
Write a script that asks the visitor to enter the number in prompt until the visitor presses Cancel and each time adds the value you entered to the total amount.
prompt . Introduction is added to the value of the total variable.Cancel button in prompt .Cancel button, show alert with the line 'Загальна сума чисел дорівнює [сума]' .? There is no need to check that the user has introduced the number rather than an arbitrary set of characters. If you want, in the case of incorrect input, show
alertwith the text'Було написано не число, спробуйте ще раз', while the result ofpromptis not necessary to the total amount, after which the user is offered to enter the number in Prompt.
let input ;
let total = 0 ;