
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

691 Views
Protocol The URL segment that specifies the data transfer protocol to be utilised is referred to as the protocol of a URL. In this example, https:// indicates for the HTTPS protocol. We will learn how to obtain the website URL for the currently seen webpage or website in this article. The 'URL' property of the Document object, which has data on the current URL, is used to get the current URL. The "URL" property returns a string that includes the complete address of the currently seen page as well as the HTTP protocol, such as (http://). Syntax Following is the ... Read More

474 Views
When a user accesses a web application using JavaScript, the "navigator" object contains details about the browser they are currently using. You may be aware that each browser functions differently when it comes to how it interprets JavaScript. In this case, the navigator object supports in modifying your application to the user's browser preferences. The browser engine or product name can be viewed in JavaScript by accessing the "navigator.product" attribute of a navigator object. In any browser, "Gecko" is always the value of the Navigator.product property. Only compatibility considerations are used to maintain this characteristic. Syntax The JavaScript syntax for ... Read More

2K+ Views
Javascript has provided a navigator object with which we can find any information regarding the browser. To get the application name and version information, navigator object has provided navigator.appName() and navigator.appVersion() respectively. Let's discuss each of them individually.Application Name of the browserTo get the application name, the navigator object has provided navigator.appName(). It may sound weird that "Netscape" is the application name for IE11, Chrome, Firefox, and Safari. So the output we get when we use navigator.appName() is Netscape.ExampleLive Demo document.write(navigator.appName); OutputNetscapeBrowser version informationTo get the browser version information, the navigator object has provided ... Read More

132 Views
We can find a substring inside a string in two ways. One way is using the indexOf() method and the other is using ES6 includes() method. let's discuss them in detail.indexOf()syntaxindexOf(str);This method tries to check the index of the substring we need. If there is index, which means substring is present, then true will be displayed in the output else false will be displayed as output. This method is case sensitive. ExampleLive Demo var company = "Tutorix"; document.write(company.indexOf('Tutor') !== -1); document.write(""); document.write(company.indexOf('tutor') !== -1); Outputtrue falseincludes()syntaxincludes(str);Unlike the indexOf() ... Read More

419 Views
In javascript, we can split a string in 3 ways. One is an old way in which string.split() method is used and later on, ES6 has provided 2 more ways to split a string. In the first way spread operator is used and in the second way array.from() method is used. Let's discuss them in detail.String.split()syntaxstring.split();ExampleIn the following example, string.split() method is used to split the provided string to each individual character.Live Demo const str = 'Tutorialspoint' var d = str.split('') document.write(d); OutputT, u, t, o, r, i, ... Read More

720 Views
In this article we are going to learn about how to repeat a string in JavaScript. We can find the three different ways to repeat a string in JavaScript they are listed below. using a while loop using recursion using ES6 repeat() method Let’s dive into the article to learn more about how to repeat a string in JavaScript. While loop method A while loop in JavaScript is a control flow statement that allows code to be executed repeatedly based on a given boolean condition. Syntax Following is the syntax for while loop while (condition) ... Read More

233 Views
Swapping variables has become very easy with destructuring. In contemporary javascript swapping takes place by using another variable. It may not be hectic but it is lengthy. But in modern javascript there is no need for the third variable. Let's discuss it in detail.Example-1In the following example, swapping has done using another variable called "temp". Therefore the code got lengthier. Live Demo var a = "Sachin"; var b = "Tendulkar"; document.write("Before swapping-"+ " "+ a + " " +b); var tmp = a; a = b; ... Read More

391 Views
In this article let us understand how to check whether a NaN is a NaN or not in JavaScript. Literal constant that is not quoted Not-a-Number is represented by NaN, a special value. NaN is commonly used to signal an error condition for a function that should return a valid number since it always compares unequally to any number, including NaN. Differentiating between different undefined values in JavaScript can be tricky. When working with NaN values in Boolean operations, there are a handful of difficulties to be careful of. The numeric type in JavaScript permits you to describe numbers of ... Read More

191 Views
We can attach two strings using the concat() method. But if we need to attach a specific string at the starting of the first string then the easiest way is string.padStart(). This method not only adds the second string at the start of the first string but also looks after the number of characters to be added. It basically takes two parameters one is the length and the other is second string. The method string.padStart() add the second string to the first based on the length provided to it.syntaxstring.padStart(length, "string");It takes the length as the parameter to concise the resulted string to those ... Read More

1K+ Views
concat() methodThe fundamental operation for combining two strings is concatenation. String combining is a necessary part of programming. We need to first clear out the fundamentals before we can discuss "String Concatenation in JavaScript." A new string is produced when an interpreter performs the operation.In order to create a new string, the concat() method joins the calling string and the string arguments. The initial string and the string that was returned are unaffected by changes to either.When concatenating, string values are first transformed from parameters that are not of the type string.SyntaxFollowing is the syntax of concat() methodconcat(str1) concat(str1, str2) ... Read More