Project Requirements:

The TypeScript Currency Converter Project: the users enter a certain amount of money in one currency and set the currency they want to check the monetary value of.

Analysis:

Users of the TypeScript currency converter project enter a certain amount of money in one currency and set the currency they want to check the monetary value of.

While developing the app, beginners can master variables, algorithms, loops, if statements, and other TypeScript concepts.

Shebang code:

The #!/usr/bin/env node line tells the operating system to use the Node.js interpreter to run the script. This is a common convention in Node.js scripts.

The #!/usr/bin/env part tells the operating system where to find the Node.js interpreter. The node part is the name of the Node.js interpreter.

This line is typically placed at the beginning of a Node.js script. It is important to note that this line is only a convention and is not required.

Import modules:

The `inquirer` module is imported from the `inquirer` package. You need to install the inquirer module first using the npm install inquirer command.

Define an object:

Defines an object called Converstion which contains exchange rates between different currencies. The object has five properties, each of which represents a different currency: GBP, EUR, USD, AUD, and PKR. Each property is a nested object that contains the exchange rates between the current currency and the other four currencies.

  • The Converstion object stores exchange rates between different currencies.
  • The Converstion object has five properties: GBP, EUR, USD, AUD, and PKR.
  • Each property of the Converstion object is a nested object that contains the exchange rates between the current currency and the other four currencies.

Function startLoop:

  • The startLoop function prompts the user to convert an amount of money until they say no.
  • The startLoop function uses the inquirer library to prompt the user.
  • The startLoop function uses the convertAmount function to convert the amount of money entered by the user.

Function convertAmount:

  • The convertAmount function prompts the user to select a currency to convert from, a currency to convert to, and an amount to convert.
  • The convertAmount function uses the inquirer library to prompt the user.
  • The convertAmount function uses the Converstion object to convert the amount of money.
  • The convertAmount prints the result of the conversion to the console.

 

Ahmer Arman

Best Laptop

JII Stores

GitHub Link