Found 10877 Articles for Web Development

How do I get started with Node.js?

Anvi Jain
Updated on 23-Jun-2020 06:41:12

117 Views

To get started with Node.js, you need to first set its environment. If you are still willing to set up your environment for Node.js, you need the following two software available on your computer, (a) Text Editor and (b) The Node.js binary installable.Let’s see how to install Node.js binary distribution on Windows. Download the latest version of Node.js installable archive file from Node.js official website.Use the MSI file and follow the prompts to install the Node.js. By default, the installer uses the Node.js distribution in “C:\Program Filesodejs”. The installer should set the “C:\Program Filesodejs\bin” directory in the window's PATH environment variable. ... Read More

What are JavaScript Identifiers?

Smita Kapse
Updated on 23-Jun-2020 06:44:09

4K+ Views

JavaScript Identifiers are names given to variables, functions, etc. It is the same as identifiers in other programming languages like C, C++, Java, etc. Let’s see identifiers for variable names.The following are legal variable names −val val1 resultWhile naming your variables in JavaScript, keep the following rules in mind.You should not use any of the JavaScript reserved keywords as a variable name. These keywords are mentioned in the next section. For example, break or boolean variable names are not valid.JavaScript variable names should not start with a numeral (0-9). They must begin with a letter or an underscore character. For ... Read More

How to use comments to prevent JavaScript Execution?

Ankitha Reddy
Updated on 30-Jul-2019 22:30:21

205 Views

If you want another code while working in the same code document, then use comments. Comment the previous code and add the alternative code to test it. After the testing completes, uncomment the previous code. In this way, you can test both the codes. While using comments follow the below rules to create valid comments − Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript. Any text between the characters /* and */ is treated as a comment. This may span multiple lines. JavaScript also recognizes the ... Read More

How much should be a JavaScript Line Length?

Nitya Raut
Updated on 17-Jan-2020 09:59:56

525 Views

Try to keep the length of lines less than 80 characters. This would make the code easier to read. Best practice is to move to next line using break if JavaScript statements aren’t fitting in a single line.In addition, move to next line only after a comma or operator. For example, you can add statement like this, with a break after operator,function display() {    var a = "";    a = a + isNaN(6234) + ": 6234";        a = a + isNaN(-52.1) + ": -52.1";    a = a + isNaN('') + ": ''";    document.getElementById("test").innerHTML = a; }

How to name JavaScript Identifiers?

Shubham Vora
Updated on 12-Oct-2022 08:57:42

1K+ Views

In this tutorial, we will learn how to name JavaScript Identifiers. Identifiers in JavaScript are the names we give to variables, arrays, objects, functions, etc We must give the names unique to identify them properly. There are some rules we must follow to name the identifiers that are common to most languages. Rules for naming Identifiers There are certain rules we have to follow before naming an identifier. A proper name helps the programmer to make the code more effective. The rules are the following − JavaScript identifier names should not start with any numeric values like 0-9. For ... Read More

What are common HTML Events supported by JavaScript?

Jennifer Nicholas
Updated on 23-Jun-2020 06:45:25

108 Views

The following are some of the common HTML events supported by JavaScript −AttributeValueDescriptiononclickscriptTriggers on a mouse clickoncontextmenuscriptTriggers when a context menu is triggeredondblclickscriptTriggers on a mouse double-clickondragscriptTriggers when an element is draggedondragendscriptTriggers at the end of a drag operationondragenterscriptTriggers when an element has been dragged to a valid drop targetondragleavescriptTriggers when an element is being dragged over a valid drop targetondragoverscriptTriggers at the start of a drag operationondragstartscriptTriggers at the start of a drag operationondropscriptTriggers when dragged element is being droppedondurationchangescriptTriggers when the length of the media is changed

How to pass an object as a parameter in JavaScript function?

Shubham Vora
Updated on 13-Sep-2023 15:33:27

29K+ Views

In this tutorial, we will learn how to pass an object as a parameter in a JavaScript function. One of JavaScript's data types is represented by the Object type. It is used to store keyed collections as well as more complex entities. The Object() function Object()or the object initializer / literal syntax can be used to create objects. Almost all JavaScript objects are instances of Object; a typical object inherits properties (including methods) from Object.prototype, though these properties may be shadowed (a.k.a. overridden). Following are the methods used to pass an object as a parameter in a JavaScript function. Using the ... Read More

How to catch any JavaScript exception in Clojurescript?

Sravani Alamanda
Updated on 08-Dec-2022 10:23:09

140 Views

In our code, usually, we will get an issue with errors. Errors will disturb the normal flow of our application. So, it is required to handle error exceptions in our code to implement any application in any programming language. Now, we will see how to handle exceptions in Clojurescript. Before that, first we learn what Clojurescript is. What is ClojureScript? At the fundamental level, Closurescript is an accent of the closure programming language that is used to compile to JavaScript. Actually, closure originally compiled only to Java virtual machine bytecode, later in 2011 Closurescript came as an option to ... Read More

How to define custom JavaScript exceptions?

V Jyothi
Updated on 23-Jun-2020 06:33:30

98 Views

To learn how to define and implement custom JavaScript exceptions, you can try to run the following code −Example                                         Click the following to see the result:                          

How to catch all JavaScript unhandled exceptions?

Rishi Rathor
Updated on 23-Jun-2020 06:34:11

611 Views

To catch all JavaScript unhandled exceptions, use window.error. The onerror event handler provides three pieces of information to identify the exact nature of the error −Error message − The same message that the browser would display for the given errorURL − The file in which the error occurredLine number− The line number in the given URL that caused the errorExampleYou can try to run the following code to catch unhandled exceptions −                                         Click the following to see the result:                          

Advertisements