Skip to content

mitchell-cheng/JavaScript-Coding

Repository files navigation

JavaScript Coding

Languages

  • JavaScript

Categories

Algorithms

Binary Search

  • First bad version

Array

Array prototype

  • Array.prototype.at()
  • Array.prototype.concat()
  • Array.prototype.every()
  • Array.prototype.filter()
  • Array.prototype.flat()
  • Array.prototype.flatMap()
  • Array.prototype.forEach()
  • Array.prototype.indexOf()
  • Array.prototype.last()
  • Array.prototype.map()
  • Array.prototype.reduce()
  • Array.prototype.sample()
  • Array.prototype.snail()
  • Array.prototype.some()
  • Array.prototype.square()

Other

  • Array.of()
  • Array to Tree
  • Array Wrapper
  • Array-like to Array
  • Cartesian Product
  • Chunk
  • Decode message
  • Difference
  • Drop Right While
  • Drop While
  • Flatten
  • Generate Random Non-Duplicate Array
  • Intersection By
  • Intersections
  • Mean
  • Remove Duplicates
  • Shuffle
  • Sort By
  • Tree to Array
  • Union

Async

Async-await

  • Implement async-await using generator

Callback

  • Flatten thunk
  • Invoke a callback after a specific second

Promise

  • A+/Promise with .finally()
Static methods
  • Promise.all()
  • Promise.allSettled()
  • Promise.any()
  • Promise.race()
  • Promise.reject()
  • Promise.resolve()
  • Promise.withResolvers()
Other
  • Add two promises
  • Async addition
  • Concurrent Data Fetching from Multiple APIs
  • Makes a http request
  • Parallel URLs download
  • Sequential asynchronous operations
  • Auto-Retry Promise on Rejection
  • Retrying API Requests with Automatic Retry
  • Call APIs with Pagination
  • Log promise
  • Map Async
  • Map Async Limit
  • Promise Merge
  • Promise scheduler
  • Promise time limit
  • Promisify
  • Sleep
  • Throttle Promises
  • Traffic light
  • Ping
  • sequence
  • parallel
  • race
  • Cancels the request if it takes longer than a specified time
  • LazyMan
  • Load Images Asynchronously

Timer

  • Repeat a task at a fixed interval
  • Cache with time limit
  • Cancel interval
  • Cancel timeout
  • Clear all timeout
  • Debounce
  • Resumable interval
  • Implement setInterval
  • Implement setTimeout
  • Throttle
  • Delay setTimeout

Function

Function prototype

  • Function.prototype.call()
  • Function.prototype.apply()
  • Function.prototype.bind()

Other

  • Number of arguments & parameters
  • Curry
  • Partial
  • Compose
  • Memoization
  • Batch function

Closure

  • Add
  • Create a hello world function
  • Counter
  • Cycle
  • Once
  • Limit
  • To Be Or Not To Be

Design Pattern

  • Calculator with Method Chaining
  • Event Emitter
  • Singleton
  • Factory

String

String prototype

  • String.prototype.repeat()
  • String.prototype.trim()

Other

  • AlphaNumeric
  • Camel case to Snake case or vice visa
  • Compare version numbers
  • Compress a string
  • Find longest word length
  • Find word with longest length
  • Generate a random string
  • Most frequently occurring character
  • String length(support emojis)
  • Uncompress a string
  • Version numbers sorting

Number

  • Add comma to number
  • Add space to bank number
  • Arabic numerals to chinese characters
  • Big integer addition
  • Clamp
  • FizzBuzz
  • Is integer
  • Merge continous numbers
  • Rand7 based on rand5
  • Round to two decimal places
  • Sample size

Object

Create an object

  • Object initializer
  • Function constructor
  • Class
  • Object.create()
  • Factory

Object inheritance

  • Prototype-based
  • Class-based
  • Factory-based
  • Object.create() - based

Object static methods

  • Object.create()
  • Object.is()
  • Object.assign()
  • Object.groupBy()

Other

OOP
  • new
  • instanceof
Traverse
  • Chaining
  • Compact
  • Count By
  • Deep Clone
  • Deep Equal
  • Deep Merge
  • Deep Omit
  • Get
  • Is Object Empty
  • Key By
  • Max By
  • From pairs
  • Object Map
  • Object to Array
  • Omit By
  • Set
  • Set Object Value Safely
  • Shallow Copy
  • Squash Object

Proxy

  • Accessing negative index

Data Structures

Map

  • Create a simple store for DOM element

Browser

DOM

  • Implement a simple DOM wrapper to support method chaining like jQuery
  • VDOM
  • Calculate the number of tags in a document
  • Lazy image loading

Router

  • Create a browser history
  • Hash Router
  • Get URL postfix
  • URL format
  • URL Parsing

Web APIs

  • localStorage with expiration
  • Get the size of sessionStorage
  • Ajax
  • JSONP

CSS

  • Calculate and compare CSS specificity
  • Classnames

JSON

  • JSON.parse()
  • JSON.stringify()

Date

  • Date Interval
  • Timestamp Date Conversion
  • Formate Date

About

JavaScript challenges

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published