Types of Comments in JavaScript

Prabhas
Updated on 12-Sep-2019 08:20:29

174 Views

Single Line commentThe following is a single line comment in JavaScript. Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.// This is a comment. It is similar to comments in C++Multi-Line commentThe following is a multi-line comment in JavaScript./*    * This is a multiline comment in JavaScript    * It is very similar to comments in C Programming */

Difference Between Single-Line and Multi-Line Comments in JavaScript

varma
Updated on 12-Sep-2019 08:19:19

641 Views

Single Line commentThe following is a single line comment in JavaScript. Any text between a // and the end of a line is treated as a comment and is ignored by JavaScript.// This is a comment. It is similar to comments in C++Multi-Line commentThe following is a multi-line comment in JavaScript./*    * This is a multiline comment in JavaScript    * It is very similar to comments in C Programming */

What Are Unbounded Wildcards in Java Generics Method

Maruthi Krishna
Updated on 12-Sep-2019 08:17:35

2K+ Views

Generics is a concept in Java where you can enable a class, interface and, method, accept all (reference) types as parameters. In other words it is the concept which enables the users to choose the reference type that a method, constructor of a class accepts, dynamically. By defining a class as generic you are making it type-safe i.e. it can act up on any datatype.To define a generic class you need to specify the type parameter you are using in the angle brackets “” after the class name and you can treat this as datatype of the instance variable an ... Read More

Lower Bounded Wildcard with Generics Method in Java

Maruthi Krishna
Updated on 12-Sep-2019 08:09:36

324 Views

Generics is a concept in Java where you can enable a class, interface and, method, accept all (reference) types as parameters. In other words it is the concept which enables the users to choose the reference type that a method, constructor of a class accepts, dynamically. By defining a class as generic you are making it type-safe i.e. it can act up on any datatype.To define a generic class you need to specify the type parameter you are using in the angle brackets “” after the class name and you can treat this as datatype of the instance variable an ... Read More

Do We Need to Use Semicolons in JavaScript

varun
Updated on 12-Sep-2019 08:05:42

218 Views

In JavaScript, Semicolons are optional. Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. JavaScript, however, allows you to omit this semicolon if each of your statements is placed on a separate line. It is a good programming practice to use semicolons.For example, the following code could be written without semicolon.     But when formatted in a single line as follows, you must use semicolons −    

When to Use a Semicolon After Curly Braces in JavaScript

varma
Updated on 12-Sep-2019 08:04:37

389 Views

In JavaScript, Semicolons are optional. Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. JavaScript, however, allows you to omit this semicolon if each of your statements is placed on a separate line. It is a good programming practice to use semicolons.In JavaScript, use a semi-colon after a statement. Let’s see an example of a variable assignment:var s = function() {    alert("Hello World!"); };However, semicolons aren’t necessary for the following function declarations:function() {    alert("Hello World!"); };

Upper Bounded Wildcard in Generics Method in Java

Maruthi Krishna
Updated on 12-Sep-2019 08:01:45

412 Views

Generics is a concept in Java where you can enable a class, interface and, method, accept all (reference) types as parameters. In other words it is the concept which enables the users to choose the reference type that a method, constructor of a class accepts, dynamically. By defining a class as generic you are making it type-safe i.e. it can act up on any datatype.To define a generic class you need to specify the type parameter you are using in the angle brackets “” after the class name and you can treat this as datatype of the instance variable an ... Read More

Difference Between Bower and npm in JavaScript

vanithasree
Updated on 12-Sep-2019 07:59:03

219 Views

  npmnpm is generally used for managing Node.js modules and does nested dependency tree. It also works for front-end and used for developer tools like Grunt, CoffeeScript, etc.Without using nested dependencies it is difficult to avoid dependency conflicts. So, using npm has proven to be great.Whatever you add in Node is structured as modules. On using NPM for browser-side dependencies, you'll structure your code like Node.Here’s the dependency structure:project root [node_modules] -> dependency P -> dependency Q [node_modules] -> dependency P -> dependency R [node_modules] -> dependency Q [node_modules] -> dependency P -> dependency SBower Bower requires a flat dependency tree and ... Read More

Use of Semicolons After Functions in JavaScript

V Jyothi
Updated on 12-Sep-2019 07:35:58

224 Views

Commonly, adding semicolons in JavaScript is optional. Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. JavaScript, however, allows you to omit this semicolon if each of your statements is placed on a separate line.No need of a semicolon in a function declaration:function functionname(s) { }If the function is written as a statement, it should have a semicolon like any other statement in JavaScript:var a = function functionname(s) { };

Minimize the Use of Global Variables in JavaScript

Johar Ali
Updated on 12-Sep-2019 07:30:40

275 Views

A global variable has global scope which means it can be defined anywhere in your JavaScript code. To minimize the usage of global variables, use consistent variables around different parts of your project.var myValue = {    common: function(){       //Add code    },    val1: {       myVar1: "Demo String One",       func1: function(){          //Add some code       },    }    val2: {       myVar1: "Demo String Two",       func1: function(){          //Add another code       },    }    val3: {       myVar1: "Demo String Three",       func1: function(){          //Add another code here       }    } };

Advertisements