Friday, 10 September 2021

JS function understanding - Part 2

From previous couple of post, hope you understood the exact meaning and usage of the JavaScript function. To understand further on this topic, We will look into create the JavaScript function with arguments.

The purpose of the arguments we passing into function is executing the result on the runtime.

Example, think this way you want to check the ticket availability or status of your ticket booking  , and trying to calculate the forex for the given currency.

Example:

On this picture, I am keying the input INR 100 (argument) to convert into USD.














How can we implement in JavaScript through function ?
function CovertINR2USD(x)
{
   let USD = 73.4;
    return x/USD
}
let returnValue = CovertINR2USD(100);
console.log(returnValue);

No comments:

Post a Comment

Powershell Regex Curly braces

This post just shows on how to create the regex pattern to extract the values between double curly braces.