Others - Javascript

Commands


  • // => Single-line Comment
    • /* */ => Write a multi-line comment
  • "use strict" => Puts some restrictions on the way of writing code
  • eval() => Evaluate like a calculator
  • var.toFixed(n) => Prints up to n decimal numbers
  • Encoding
    • btoa("value") => To create a Base64 encoded ASCII string from the binary data, For binary data consisting of 8-bit bytes
    • atob("value") => Decodes a string of data that was encoded using Base64 encoding back to normal text
  • Audio
    • var = new Audio("filePath")
    • var.play()
  • Forms
    • inputs.every(input => checkValidity()) => Returns true if all valid
    • inputs.every(input => reportValidity()) => Returns true if all valid and displays error message

Inspect Element


  • Basic
    • ctrl + shift + R => If site crashes then press this to reload everything
    • ctrl + shift + I => Inspect in a Web Browser
  • Sources
  • Elements
  • Console
    • Numbers are represented in Blue
    • Strings are represented in Black
    • shift + enter => To move to next line without executing code
    • Tricks
      • document.body.contentEditable = true => Lets you edit a website
  • Network
    • Throttling => Change the speed of Internet speed
  • Performance
  • Application
    • Storage
  • Security
  • Lighthouse
    • Generate Report => Gives report of your website based on Core Web Vitals
Share: