Found 8895 Articles for Front End Technology

How to do case-sensitive string comparison in JavaScript?

Shubham Vora
Updated on 26-Oct-2022 08:33:18

3K+ Views

This tutorial will guide you to learn case-sensitive string comparison in JavaScript. JavaScript is case-sensitive. Keywords, variables, function names, and any identifiers in JavaScript must be in the required case. For example, for keyword cannot be written as For or FOR. What are strings in JavaScript? A string is a collection of one or more characters, which could be letters, numbers, or symbols. Strings are immutable primitive data types in JavaScript, which implies they can never change. Text can be stored and modified using JavaScript strings. Any number of characters enclosed in quotations is a JavaScript string. How can we ... Read More

Why is JavaScript case sensitive but HTML isn't?

varun
Updated on 12-Sep-2019 08:28:32

295 Views

A script is in plain text and not just markup like HTML, which is case insensitive. In JavaScript, the while keyword should be "while", not "While" or "WHILE". Case sensitivity is important since it is closely related to HTML, but some methods and events are mentioned differently. JavaScrip has a strict syntax to process the client-side-scripts written in JavaScript.Some tags and attributes in HTML have the same name as JavaScript objects and properties. In HTML, the attribute and tag names are case-insensitive. The close association of HTML and JavaScript can lead to confusion, so case sensitivity is more important in ... Read More

Why is case sensitivity so much more important in JavaScript?

Prabhas
Updated on 30-Sep-2019 07:41:32

74 Views

A script is in plain text and not just markup like HTML, which is case insensitive. In JavaScript, the while keyword, should be "while", not "While" or "WHILE". Case sensitivity is important since it is closely related to HTML, but some methods and events are mentioned differently.Some tags and attributes in HTML have the same name as JavaScript objects and properties. In HTML, the attribute and tag names are case-insensitive. The close association of HTML and JavaScript can lead to confusion, so case sensitivity is more important in JavaScript. For example, HTML onclick event attribute is mentioned as onClick in ... Read More

What are valid values for the id attribute in HTML?

Bhanu Priya
Updated on 04-Oct-2023 15:54:16

955 Views

The ID attribute in HTML is called as unique identifier for the element. It helps in identifying an area in a web page by using CSS styles, targets for scripts and anchor links. First let us see, what is the use of ID attributes in HTML − The ID attribute can perform different actions on web pages by using commands − ID attribute used to reference for scripts − In JavaScript functions, we use ID attribute for making changes to the precise element on the page with our scripts. ID attribute use for style sheet selector − Most of ... Read More

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

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

161 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

472 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

4K+ 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 06-Sep-2023 21:27:21

37K+ Views

To create a line break in JavaScript, use "". With this, we can add more than one line break also.ExampleLet’s see it in the below example:                              

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

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

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

Advertisements