Schedule A Consultation

    Fields marked * are mandatory

      CA INQUIRY

      JavaScript console commands

      This entry was posted on Thursday December 2, 2021

      1. console.log()

       

      The first and most normal command is the console.log() command. It takes in a message and prints out the outcome to the control center. It can likewise print JavaScript objects, clusters – all information types in JavaScript. Moreover, it deals with organizing the yield of the outcome to make it simpler to follow.

       

      console.log(“Hello World!!!”);

      console.log({

        id: 01,

        name: “lorem ipsum”,

      });,

      console.log([“Cat”, “Dog”]);

       

      2. console.error()

      The console.log() command is utilized by engineers for a large portion of the things they do – including logging blunders to the control center. In any case, do you know there is an extraordinary control center command for that ? It is the console.error() command. It is basically the same as the console.log() command aside from it wraps what you sign in a red blunder box.

       

      console.error(“Error: Something is wrong!!!”);

       

      3. console.info()

      This control center command is particularly valuable to yield data to the control center. Rather than utilizing console.log(), you will utilize console.info() to make the data stand apart from other control center commands.

       

      console.info(“It’s working…! “);

       

      4. console.table()

      When managing exhibits, you typically prefer to address it in a straightforward construction. The console.table() commands handle that for you.

       

      console.table([“Javascript”, “ReactJS”, “VueJS”]);

       

      5. console.assert()

      This control center command composes a blunder message to the control center if an assessed condition is bogus.

       

      console.assert(5 > 7, “It cannot be!”);

       

      6. console.clear()

      This command clears the control center for you.

       

      console.clear();

       

      7. console.group() and console.groupEnd()

      These two control center commands are valuable to gather stuff in the control center. 

       

      The console.group() is utilized to begin a gathering. The gathering will proceed until it experiences a console.groupEnd().

       

      8. console.warn()

      Logging alerts in the control center ought to be simple! That is the reason the console.warn command exists

       

      console.warn(“Warning: Something went wrong!”);

       

      9. console.time() and console.timeEnd()

      There will be times when you will need to measure the time taken for an activity to finish. For these circumstances, you can utilize the console.time() and console.timeEnd() capacities. 

       

      You utilize the console.time() to begin a clock and console.timeEnd() to stop the clock.

       

      console.time();

       

      for (let i = 0; i < 7; i++) {

        console.log(“Number: ” + i);

      }

       

      console.timeEnd();