
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

261 Views
To print content of JavaScript object, you can try to run the following code. Here, the object is created using the new keyword −ExampleLive Demo var dept = new Object(); dept.employee = "Amit"; dept.department = "Technical"; dept.technology ="C++"; document.getElementById("test").innerHTML = dept.employee + " is working on " + dept.technology + " technology.";

10K+ Views
You can extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiry date within the cookie. This can be done by setting the ‘expires’ attribute to a date and time.ExampleYou can try to run the following example to set cookies to expire in 1 hour − Enter name:

21K+ Views
In this tutorial, we will learn to clear all cookies using JavaScript. The cookies are the text or data stored in the format of text files in the browser or user's computer, and it is one kind of cache memory. The developer can store the username, authentication tokens, etc., in the browser's cookies. When a user visits the webpage for the first time, it retrieves the user information from the server and stores it in the cookie format in the browser. After that, when a user visits the webpage again, it retrieves the required data from cookies instead of the ... Read More

5K+ Views
Extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiry date within the cookie. This can be done by setting the ‘expires’ attribute to a date and time.ExampleYou can try to run the following example to set the expiry date of a cookie by 1 Month − Enter name:

787 Views
Using cookies is the most efficient method of remembering and tracking preferences, purchases, commissions, and other information required for better visitor experience or site statistics.The simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this.document.cookie = "key1=value1;key2=value2;expires=date";Here the expires attribute is optional. If you provide this attribute with a valid date or time, then the cookie will expire on a given date or time and thereafter, the cookies' value will not be accessible.Note − Cookie values may not include semicolons, commas, or whitespace. For this reason, you may want to ... Read More

386 Views
In this example, we will learn how the prototype works in JavaScript. It is rare if a JavaScript developer doesn’t use the objects while developing the functions, and the objects can make a lot of work easy for developers.The prototype is also the advanced concept associated with the objects in JavaScript. Many of you have heard about the prototypes for the first time but don’t worry. We will cover all things about the prototypes in this tutorial.What does the prototype do?The prototype is the object created for every function class when the program starts execution. However, it depends on the ... Read More

673 Views
In this tutorial, let us discuss the smart, self-overwriting, or lazy-getters in JavaScript. A getter binds the property of an object to a function, but the getter will not calculate the property value until we access it. The getter helps when we need to get some dynamic value without an explicit call. Users can follow the syntax below to work with the getters. Syntax { get prop() {} } { get [exp]() {} } The prop and the exp are the object's properties that bind to a function. 'prop' is a simple object property, and 'exp' is an expression. ... Read More

13K+ Views
To execute JavaScript at the command prompt, can be achieved through various methods depending on the environment. We will be discussing three different approach which can be used to execute JavaScript at the command prompt with stepwise explanation of steps. In this article, our task is to execute JavaScript at the command prompt. Different Methods to Run JavaScript at Terminal Here is a list of methods that can be used to execute JavaScript at the command prompt which we will be discussing in this article with stepwise explaination and complete example codes. Runnning JavaScript File ... Read More

272 Views
To concatenate several string, use “Array.join()” method. Here, we will concat the following strings:John Amit SachinExampleYou can try to run the following code to concat several stringsLive Demo var arr = ['Amit', 'John', 'Sachin']; document.write(arr.join(', '));