Skip to main content

JavaScript with ES6

Methods - 

  • Array -
    • array.splice(startIndex, deleteCount, replace/add)
    • array.reverse()
    • array.join()
    • array.concat(array)
For loop:

  • for(const i of nums)
  • forEach(

Hoisting in javascript

Variable types:

  • var - function-scope
  • let - block-scoped variable (accessible inside the block variable is defined) , can not be accessed before initialization.
  • const


Java Script with ES6 (Modern day way to code in Java Script)


- Template literal 

eg.: `Hello ${userName}!`


- parseInt - convert to number from string type of numbers

-parseFloat

-typeof  - provide the type

equality or strict equality - == Vs === 

    (value only Vs value + type)


Ternery Operator:

condition ? expIfTrue : expIfFalse

Comments

Popular posts from this blog

API Basics

 

Algorithm solving Common Patterns & Techniques

  These are targeted data manipulation strategies used to handle arrays, strings, and linked lists efficiently. Two Pointers : Uses two reference pointers to iterate through a data structure simultaneously, typically from opposite ends or at different speeds (Fast & Slow pointers). Sliding Window : Maintains a subset of data (a "window") over a sequential structure to track running statistics without recalculating the whole set. Prefix Sum : Pre-computes and stores cumulative sums of an array to allow for \(O(1)\) constant-time range sum queries. Dynamic Programming (DP ): Dynamic programming is an optimization technique used to solve problems by breaking them down into simpler subproblems and storing the results of these subproblems to avoid redundant computations. It is particularly effective for problems exhibiting overlapping subproblems and optimal substructure. Greedy Algorithm Breadth-First Search (BFS) / Depth-First Search (DFS) : Systematic graph and tree travers...