Found 10877 Articles for Web Development

How to convert seconds to HH-MM-SS with JavaScript?

Shubham Vora
Updated on 17-Aug-2022 12:38:30

3K+ Views

In this tutorial, we will learn to convert seconds to Hours, Minutes, and Seconds (HHMM-SS) format in vanilla JavaScript. The date and time are an integral aspect of our daily lives; date and time are frequently used in computer programming. You might need to write a website in JavaScript with a calendar, a rail schedule, or an interface for scheduling appointments. So, for such purposes, JavaScript provides us with some inbuilt functions like the getTime() returns the number of milliseconds since January 1, 1970, 00:00:00. Using the toISOString() Method We might need to put seconds into a well-formatted structure to ... Read More

How can we debug JavaScript in Internet Explorer?

Srinivas Gorla
Updated on 19-Jun-2020 08:59:04

100 Views

The most basic way to track down errors is by turning on error information in your browser. By default, Internet Explorer shows an error icon in the status bar when an error occurs on the page. Double-clicking this icon takes you to a dialog box showing information about the specific error that occurred. Since this icon is easy to overlook, Internet Explorer gives you the option to automatically show the Error dialog box whenever an error occurs. To enable this option, select Tools → Internet Options → Advanced tab. and then finally check the "Display a Notification About Every Script Error" box option as ... Read More

How can we debug JavaScript using Firefox?

Shubham Vora
Updated on 30-Aug-2022 07:02:27

2K+ Views

In this tutorial, we will learn to debug the JavaScript code using the Firefox web browser. Generally, we debug the code to fix the unknown bugs and errors. Mostly it happens with beginner programmers, code works successfully until the last night and suddenly crashes in the morning Programmers don’t need to worry now, even if code crashes. Once you learn to debug the code, you can fix any bugs in a few minutes and make it work fine If users want to learn to debug the code, the first step is to produce the code example with the error. So, ... Read More

How to do basic form validation using JavaScript?

Vrundesha Joshi
Updated on 19-Jun-2020 08:56:24

477 Views

JavaScript provides a way to validate form's data on the client's computer before sending it to the web server. Basic form validation includes the form to be checked to make sure all the mandatory fields are filled in. It would require just a loop through each field in the form and check for data.ExampleYou can try to run the following code to implement basic form validation in JavaScript −           Form Validation                // Form validation          function validate(){             if( document.myForm.Name.value ... Read More

How to catch exceptions in JavaScript?

Ankitha Reddy
Updated on 16-Jan-2020 09:15:08

240 Views

To catch exceptions in JavaScript, use try…catch…finally. JavaScript implements the try...catch...finally construct as well as the throw operator to handle exceptions.You can catch programmer-generated and runtime exceptions, but you cannot catch JavaScript syntax errors.ExampleYou can try to run the following code to learn how to catch exceptions in JavaScript − Live Demo                                         Click the following to see the result:                          

How do I check for null values in JavaScript?

Shubham Vora
Updated on 22-Jul-2022 12:08:42

17K+ Views

In this article, we will learn how to check the null values in JavaScript. The null value indicates the intentional absence of any object value. It is a JavaScript primitive value that is false when used in Boolean operations. This distinguishes null from the related primitive value undefined, which is an unintended absence of any object value. This is because a variable that has been declared but not given a value is undefined rather than null.You may visualize a variable as a box by using a real-world analogy. The box can hold things like a teapot, just like a variable ... Read More

What is onerror() Method in JavaScript?

Abhinaya
Updated on 19-Jun-2020 08:54:39

2K+ Views

The onerror event handler was the first feature to facilitate error handling in JavaScript. The error event is fired on the window object whenever an exception occurs on the page.ExampleYou can try to run the following code to implement onerror() method in JavaScript −                                         Click the following to see the result:                          

How do we use throw statement in JavaScript?

Shubham Vora
Updated on 20-Jul-2022 14:27:37

388 Views

In this tutorial, we will learn to use the throw statement in JavaScript. The “throw” is the reserved keyword in JavaScript, and Programmers can use the throw keyword to create the user-defined exception.Every programmer is not perfect, so they can’t write the JavaScript code without making a single error. It also happens that programmers are taking the input from the user, and an exception occurs if the user enters the invalid input. Some built-in exceptions include arithmetic exceptions, Index out-of-bound exceptions, etc. In some cases, programmers want to create their exception and can do it using the throw statement inside ... Read More

What are runtime errors in JavaScript?

Rishi Rathor
Updated on 16-Jan-2020 09:06:21

202 Views

There are three types of errors in programming: (a) Syntax Errors, (b) Runtime Errors, and (c) Logical Errors. Runtime errors, also called exceptions, occur during execution (after compilation/interpretation). For example, the following line causes a runtime error because here the syntax is correct, but at runtime, it is trying to call a method that does not exist.     Exceptions also affect the thread in which they occur, allowing other JavaScript threads to continue normal execution.

What are syntax errors in JavaScript?

Prabhas
Updated on 16-Jan-2020 08:44:48

174 Views

Syntax errors also called parsing errors, occur at compile time in traditional programming languages and at interpret time in JavaScript. For example, the following line causes a syntax error because it is missing a closing parenthesis.     When a syntax error occurs in JavaScript, only the code contained within the same thread as the syntax error is affected and the rest of the code in other threads gets executed assuming nothing in them depends on the code containing the error.  

Advertisements