
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

21K+ Views
To create a link to send email, use tag, with href attribute. The mail to link is added inside the tag. To add a subject, you need to add ? and then include the subject. All this comes inside the tag.Just keep in mind to add the email address where you want to receive the email in the mail to link. Also, the spaces between words for the subject shouldn’t be space, instead include %20. This is to ensure the browser displays the text properly.ExampleYou can try to run the following code to create a link to ... Read More

322 Views
In this tutorial, let us discuss the function scope and context in JavaScript. Functions are the building blocks of Javascript. Therefore, JavaScript is a functional programming language. Scope The 'scope' is the code space where we can define and use a variable in a function. Scopes are of four types. Global scope Global 'scope' is the default scope. A variable with global 'scope' is accessible throughout the program. Browser closing removes a global variable. Window objects can access var variables wherein they can't access the let variables. Functional or local 'scope' A function variable is accessible only with the function. ... Read More

235 Views
A function is a group of reusable code which can be called anywhere in your program. This eliminates the need of writing the same code repeatedly. It helps programmers in writing modular codes.The most common way to define a function in JavaScript is by using the function keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces.Here’s an example − To call a function somewhere later in the script, you would simply need to write the name of that function as shown in the following ... Read More

169 Views
defaultThis came to handle function parameters with ease. Easily set Default parameters to allow initializing formal parameters with default values. This is possible only if no value or undefined is passed. Let’s see an exampleExampleLive Demo // default is set to 1 function inc(val1, inc = 1) { return val1 + inc; } document.write(inc(10, 10)); document.write(""); document.write(inc(10)); restES6 ... Read More

18K+ Views
In this tutorial, we will learn to concatenate the multiple string variables in JavaScript. It’s many times needed that we need to concatenate two strings in a single variable and use it. The simple meaning of concatenation is to merge two or multiple strings. Also, string concatenation is useful to insert some substring in the parent string. For example, while developing the application, as a programmer, you need to update the string by adding some other extra string to it. Users can split the string first and insert the substring using the concatenation operation. There are various methods to merge ... Read More

3K+ Views
No, you cannot create a dialog box with “yes” or “no”. A confirmation dialog box in JavaScript has “Ok” and “Cancel” button.To create a dialog with “yes” or “nor”, use a custom dialog box.ExampleLive Demo function functionConfirm(msg, myYes, myNo) { var confirmBox = $("#confirm"); confirmBox.find(".message").text(msg); confirmBox.find(".yes, .no").unbind().click(function() { confirmBox.hide(); }); ... Read More

4K+ Views
In this tutorial, we will learn to change the button label in the alert box using JavaScript. The alert box is one kind of popup box that is useful to show some important information to the user. We can pop up the alert box using JavaScript's alert() method. The default alert box contains the simple message and ok button, which pops out at the top center of the browser's screen. The default alert box with only messages and without any style looks weird. So, we need to make it stylish and change the style of the button and the label ... Read More

1K+ Views
Calling a JavaScript function directly from C++ depends on the environment and the system; for this, make sure you have embedded a JavaScript engine or integrated C++ with JavaScript. In this article, we will be using Emscripten (C++ to JavaScript in WebAssembly) to call a JavaScript function from C++. For this, you have to compile the C++ program to WebAssembly using Emscripten and then call JavaScript functions from C++. So, first, create the C++ file with the header . C++ File Let's consider that this file name is saved as main.cpp. #include // here declared an external JS ... Read More

815 Views
Adding semicolons after every function is optional. To avoid undesirable results, while using functions expressions, use a semicolon.Using semicolonvar display = function () { alert(“Hello World”); }; (function () { // code })();Without using semicolonvar display = function () { alert(“Hello World”); } (function () { // code })();The first function executes immediately since we have used the semicolon.