Posts

Showing posts from March, 2024

How we can return a specific element of an Array from function in JavaScript?

Image
 For outside array Steps: Step 1:   Define an array. For example, let’s define an array of Number               Step 2: Define a function that takes two parameters:   array and the index  Step 3: In this function,   array[index]   will return the element at the specified index in the array Step 4:  Call the function with the number ( original Array ) and the index of the element you want to return Another Method πŸ‘‡ For inside array click to : https://learningjavascript1.blogspot.com/2024/03/how-function-return-array-in-javascript.html

How function return an Array in JavaScript

Image
  How function return an Array in JavaScript πŸ‘‰  Array in function similarly work as Object in function. Here we will see normal syntax of Function & Array together πŸ‘‰Let access both array color[] and fruits[] Another way:  https://learningjavascript1.blogspot.com/2024/03/how-we-can-return-specific-element-of.html

How a function returns an Object Javascript

Image
  We saw how a function work step by step:   Function Data Flow Now we will learn how a function return an object in JavaScript πŸ‘‰ Let first define a function without parameter and create an object inside function body      and call it πŸ‘‰ Now we will call a function with parameter πŸ‘‰ Now store the returned value in - functionName () that include arguments ( " Pritam ", 30 ) for      further use & print it in console by console.log Note: rules should be added on 22 march  like parameters are variable and steps of function data flow and with object how its react

Function Data Flow

Image
How function work in JavaScript   Here is Default syntax of function: Steps: 1st: When we call the function with arguments(10,20), both arguments stored in  parameter (parameter1, parameter2                                                                 πŸ‘‡ 2nd: then it stored in function body where it called like we called both parameter with  return statement                                                                 πŸ‘‡ 3rd: when we use return  statement then the operation of parameter (here we sum both parameter) stored in function name(function_name)                           ...