JavaScript tips and tricks

Query Selector

When testing things in browser's dev tools, instead of typing the lengthy `document.querySelectorAll` you can use `$$`.

$$("div") instead of document.querySelectorAll("div") 


Determine the Weight of Your Web Page

$$("*"), this will return total number elements present in the document.

Get Unique Values of an Array

Set is used to return the unique value of an array.
var arr = [1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 7, 7];
const newArr = new Set(arr);

Related Articles



Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. Thanks for one marvelous posting! I enjoyed reading it; you are a great author.
    This is good information and really helpful for the people who need information about this.
    Really the post is very unique.every concepts are captured nice.

    oracle training in chennai

    oracle training institute in chennai

    oracle training in bangalore

    oracle training in hyderabad

    oracle training

    oracle online training

    hadoop training in chennai

    hadoop training in bangalore

    ReplyDelete

Post a Comment