Front End Technology Articles - Page 624 of 652

What is the difference between “lang” and “type” attributes in a script tag?

Arushi
Updated on 12-Sep-2019 08:31:25

328 Views

JavaScript lang attributeThis attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.JavaScript type attributeThis attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".Here you can see how it is used:Live Demo                              

What does language attribute do in

What is the difference between comments /*...*/ and /**...*/ in JavaScript?

radhakrishna
Updated on 12-Sep-2019 08:35:18

698 Views

/*…*/ and /**…*/ are multi-line comments. The following is a multi line comment in JavaScript./*    * This is a multiline comment in JavaScript    * It is very similar to comments in C Programming */The following example shows how to use multi-line comments in JavaScript.     The comment /** */ is for  PHPDocumentator ,  which is used to make automatic documentation.

How to Line Breaks to JavaScript Alert?

mkotla
Updated on 30-Jul-2019 22:30:21

5K+ Views

To add line breaks to JavaScript alert, use “\r”. In the following example, we will see how to display text in JavaScript alert.Example Live Demo                    function DisplayAlert() {             var newLine = "\r"             var msg = "Showing how to add line break."             msg += newLine;             msg += "Line Break can be easily added in JavaScript.";             msg += newLine;             msg += "Simply Easy Learning";             msg+= newLine;             msg += "TutorialsPoint.com";             alert(msg); }

How to create a line break with JavaScript?

Giri Raju
Updated on 07-Aug-2024 16:00:27

42K+ Views

To create a line break with JavaScript, we will be understanding three different approaches. In this article, we are having some text content and our task is to create line break using Javascript. We will be using tag, \n and insertAdjacentHTML() method along with block elements with explaination and example codes for each. Approaches to Create a Line Break with JavaScript Line Break Using br tag Line Break new line Character Line Break Using insertAdjacentHTML() Method Line Break Using br tag In this approach to ... Read More

What is the difference between single-line and multi-line comments in JavaScript?

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

700 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 */

Is JavaScript a case sensitive language?

Alshifa Hasnain
Updated on 21-Feb-2025 17:32:38

4K+ Views

JavaScript is a case-sensitive language. This means that the language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters. So the identifiers Time and TIME will convey different meanings in JavaScript. What Does Case-Sensitive Mean in JavaScript? Case sensitivity in programming refers to whether a language distinguishes between uppercase and lowercase letters.  For example − myVariable and myvariable are treated as two different identifiers. function and Function are not the same (the former is a keyword, while the latter could be a user-defined ... Read More

What does the leading semicolon in JavaScript libraries do?

mkotla
Updated on 30-Sep-2019 06:59:03

333 Views

A function in JavaScript looks like the following:(function(){...})()A library in JavaScript shows a function, which begins with a semicolon, for example:;(function ) { }The semicolon allows to safely concatenate several JS files into one. This is to serve it faster as one HTTP request.A leading semicolon can also be to protect from preceding code, which may have been improperly closed. A semicolon will definitely prevent this from happening.

How do I convert a float number to a whole number in JavaScript?

Shubham Vora
Updated on 20-Jul-2022 08:17:30

6K+ Views

In this tutorial, we will learn to convert a float number to a whole number in JavaScript. The whole number is the number that doesn’t contain the fractional part. For example, 5.22 is the float number containing the fractional part, and the whole number doesn’t contain a decimal part. So, our goal in this tutorial is to remove the fractional part from the number.We can have various methods to cut out the decimal part from the float number to make it whole, and some of them we have discussed here.Using the Math.trunc() and Math.round() MethodsUsing the parseInt() MethodUsing the Bitwise ... Read More

When should I use a semicolon after curly braces in JavaScript?

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

447 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!"); };

Advertisements