ans 1

we use javascript functions because its a basic building block of code , it help us to write a code concise , reusable and reuse it miltiple times .

ans 2

function invocation means a function got executed and its not a function was called by another function and then executed .

ans 3

Yes functions behave likes a objects in javascript , basically a function are known as first class object .example

function helloworld(){
    console.log("tarun");
};
console.dir(helloworld);

when we console.dir we see the key value pair , objects are part of this function therefore when we do

  1. helloworld.length we get 0 .
  2. helloworld.name we get "helloworld".
  3. when we do helloworld.tostring it gives body of a function in "" quotes .
  • we can assign a variable a value of a function

ans 4

Events are basically the thimgs that happen in the system you are programming , which the system tells you about so your code can react to them .

ans 5

strings in javascript are primitive data types and strings are immutable , which means the are unchanging .a javascript string is zero or more characters written inside quotes.

ans 6

Array are used to store multiple values in a single variable.each item in an array has a number attached to it, called a numeric index , that allows you to access it . Arrays in javascript are dynamic because their size is not predetermined.

ans 7

The main difference between set and map is that set contains only data elements , and map contains the data in the key-value pair , so map contains key and its value .

ans 8

An array is a collection of items stored at contiguous memory locations . the idea is to store multiple items of the same type together whereas the map is an associative container that stores elements in a mapped fashion , each element has a key value and a mapped value . No two mapped values can have equal key values .

ans 9

Array methods are functions built-in to javascript that we can apply to our arrays. some of the array methods are :

  • concat()
  • copywithin()
  • filter()
  • indexOf()

ans 10

we can traverse the array by using different loops and by directly from the index of an element.