Saturday, 25 September 2021

Saturday, 11 September 2021

JS function understanding - Part 3

 As part of understanding the JavaScript function , here is the another simple yet powerful information ,

You can create the function and assign it to variable.It can become object and referring the "function" object.

Variable can be a var , let or constant.

This function will called with the variable name not by its function name as we seen in the previous posts.

Example:

 


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);

JS function understanding

In this post , We try to understand  on how to create the simple JavaScript function and calling them in your html page or node JS.

syntax.

function functionName()

{

//business logic.

}

How to call (execute) the function , just naming the function name in your code.

Example : functionName()

Now we start to look into implementing in the HTML page. Open your favorite editor and follow this image.







Save this file .html extension and open it any of your favorite browser and hit the F12 and see the "Console" tab in the browser.

JS Function deep dive

What is function in JavaScript ? 

Function in JavaScript is fundamental building block , used to build the flexible application.
You can compare the block with "Brick" which is used to build the houses and building.
You can also define the function in JavaScript is reusable component, means you don't want to develop any core business logic from scratch but can be get it from other developer or commercial third party vendor.

Why function  is  needed ?

To simplify and managing the application efficiently . On developer side, its most convenient to trace the error and use it as per the design.

What problem it resolves ?

Code duplication and repetition on your project.

Powershell Regex Curly braces

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