Зміст курсу
Node.js Express: API & CLI Apps
Node.js Express: API & CLI Apps
Challenge: First Node App
🏆 Challenge
🎯 Goal
Prepare to begin a coding challenge to test your newfound knowledge of creating a simple Node.js application. The goal is to solidify your understanding of building a basic application using a single file and running it locally on the machine. This experience is crucial for your journey, as you'll frequently work locally in your development environment.
📋 Task
Create the Node.js application that calculates the total amount of money a user should pay for a given order. Here are the steps to complete the task:
- Start by opening a new project directory where you'll create a file named
app.js
. - Inside the
app.js
file, set three predefined variables:ordererQuantity
: The number of tumblers the user ordered;pricePerTumbler
: The price of a single tumbler;message
: The message to be logged in the console.
- Your main task is to calculate the total amount of money the user must pay for the order.
- Once you've calculated the total cost, use the
console.log()
function to display the message and the estimated total amount. - After writing the code, open your terminal and run the application.
- You should see the result in the console, displaying the total amount the user needs to pay.
// app.js const ordererQuantity = 4; const pricePerTumbler = 49; const message = "You have to pay:"; console.log(message, ___);
Дякуємо за ваш відгук!