Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: First Node App | Introduction

Node.js Express: API & CLI Apps

Challenge: First Node AppChallenge: 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:

  1. Start by opening a new project directory where you'll create a file named app.js.
  2. 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.
  3. Your main task is to calculate the total amount of money the user must pay for the order.
  4. Once you've calculated the total cost, use the console.log() function to display the message and the estimated total amount.
  5. After writing the code, open your terminal and run the application.
  6. You should see the result in the console, displaying the total amount the user needs to pay.
1. To calculate the total amount of money, multiply the pricePerTumbler with the ordererQuantity.
2. Display the message along with the calculated total cost using console.log().
3. To run the application, use node app.js command.

const ordererQuantity = 4;
const pricePerTumbler = 49;
const message = "You have to pay:";
console.log(message, pricePerTumbler * ordererQuantity);
      
1. What is the price a user should pay?
2. What command must we use to run the `app.js` file in the terminal?

What is the price a user should pay?

Виберіть правильну відповідь

What command must we use to run the app.js file in the terminal?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 1. Розділ 6

Node.js Express: API & CLI Apps

Challenge: First Node AppChallenge: 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:

  1. Start by opening a new project directory where you'll create a file named app.js.
  2. 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.
  3. Your main task is to calculate the total amount of money the user must pay for the order.
  4. Once you've calculated the total cost, use the console.log() function to display the message and the estimated total amount.
  5. After writing the code, open your terminal and run the application.
  6. You should see the result in the console, displaying the total amount the user needs to pay.
1. To calculate the total amount of money, multiply the pricePerTumbler with the ordererQuantity.
2. Display the message along with the calculated total cost using console.log().
3. To run the application, use node app.js command.

const ordererQuantity = 4;
const pricePerTumbler = 49;
const message = "You have to pay:";
console.log(message, pricePerTumbler * ordererQuantity);
      
1. What is the price a user should pay?
2. What command must we use to run the `app.js` file in the terminal?

What is the price a user should pay?

Виберіть правильну відповідь

What command must we use to run the app.js file in the terminal?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 1. Розділ 6
some-alt