Learn JavaScript array functions through a  fun analogy with BJP tactics. Explore methods such as push, concat, and more with creative examples 🚀

Learn JavaScript array functions through a fun analogy with BJP tactics. Explore methods such as push, concat, and more with creative examples 🚀

Note - I have used the BJP name Only for fun Purposes, Please don’t take it seriously

·

3 min read

In this article, we will understand 10 functions of Array using the BJP Party working Method.

  1. Array.push() -

    When other party members get caught by the ED, CBI for Corruption then automatically pushed to the BJP party, and then they are members of the party.

    Concept - .push() function pushes a new element at the end of the array and a new element is added at the end of the array

  2. Array.concat() -

    When BJP came into Power, the Party concatenated India’s ED, CBI & Election Commission of India as a part party(BJP)

    Concept - .concat() function joins two arrays and makes a new array which includes the content of that 2 arrays

  3. Array.join()

    When the BJP Destroy other parties by their special power of india_cell then that party joins the BJP as aligned power.

    Concept - By Using the .join() function we can join array values in one entity as mentioned in the output. And we can use any separator to separate the values.

  4. Array.sort()

    The priority of the BJP Party can be sorted using the sort function.

    Concept - While Sorting the array using the .sort() function,elements are sorted accordingly in alphabetical order for String (Same for number)

  5. Array.fill()

    The Person_needs array includes the needs of the person and we can see which needs have BJP_tax(GST).

    Concept - We Have Changed the in-array elements using the .fill() function. Need to range (value, Start point & End Points)

  6. Array.indexof()

    As we know on what goals do party works. If a voter decides to vote party he can check the index of their service and then he can vote.

    Note - Indexing is just numbering that number and does not decide the value of that element based on the index

    Concept - By using .indexof() we can know the index of any element in an array

  7. Array.slice()

    When Party leader gives speeches they slice the religious elements as shown in Code

    Concept - .slice() function is used to slice an array into different parts. we need to give a start and endpoint for slicing in other words need to give indexing.

  8. Array.includes()

    We can check the party promises are done or not using .include() function

    Concept - .includes() is used to check whether that element is present in the array or not.

  9. Array.some()

    We Can check specific promises that are satisfying or are true like in the BJP’s case Ram Mandir.

    Concept - The .some() function is used to check if at least one element in an array satisfies a given condition.

  10. Array.unshift()

    As we can see how the task with low priority got high priority weight age using the unshift this method/function is also used by politicians not only by engineers.

    Concept - The .unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.

~ Thank you for Reading

Â