Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript throw vs console.error

throw Error("msg"):

1. Stops js execution.
2. Mostly used for code handling purpose.
3. Can alter main flow of execution.
4. This syntax is mostly same for all browser as this is specified and validated by W3C.
-----------------
console.error("msg"):

1. It just shows output in Red color at Browser console
2. It is mostly used to print values for debugging purpose.
3. Cannot harm main flow of execution.
Comment

PREVIOUS NEXT
Code Example
Javascript :: puppeteer headless false 
Javascript :: jquery script tag 
Javascript :: js is empty object 
Javascript :: modal.show jquery 
Javascript :: javascript regex french phone number 
Javascript :: Select at random from array 
Javascript :: javascript get element height and width 
Javascript :: Unable to resolve module react-navigation 
Javascript :: Extract number from string javascripy 
Javascript :: automatically scroll to bottom of page 
Javascript :: href back page javascript 
Javascript :: Error: Timeout - Async function did not complete within 5000ms (set by jasmine.DEFAULT_TIMEOUT_INTERVAL) site:stackoverflow.com 
Javascript :: how show piece of long text in javascript 
Javascript :: how to run vue js project on different port 
Javascript :: phone number validation in yup 
Javascript :: get window width jquery 
Javascript :: execute javascript function when page loads 
Javascript :: camelcase to hyphenated javascript 
Javascript :: javascript write in id 
Javascript :: javascript remove negative numbers from array 
Javascript :: jquery style display 
Javascript :: iframe getelementbyid 
Javascript :: pass header in ajax 
Javascript :: javascript change attribute 
Javascript :: react native disable warnings 
Javascript :: write to file js 
Javascript :: node downgrade windows 
Javascript :: html how to remove attribute# 
Javascript :: document ready in jquery 
Javascript :: javascript sum array of objects 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =