In this article, we are going to discuss how to convert a string value to a Date object in JavaScript. There are two ways to achieve this − Using the constructor of the Date class − This constructor accepts a string value representing the date value, converts it into a Date object, and returns the result. Using the Date.parse() method − Same as the Date constructor this method accepts a string value parses and returns the date value in the form of milliseconds. Let us see these solutions with examples − Using the Date() constructor The most commonly used way ... Read More
The return statement in python is an extremely useful statement used to return the flow of program from the function to the function caller. The keyword return is used to write the return statement. Since everything in python is an object the return value can be any object such as – numeric (int, float, double) or collections (list, tuple, dictionary) or user defined functions and classes or packages. The return statement has the following features - Return statement cannot be used outside the function. Any code written after return statement is called dead code as it will never ... Read More
In this article, you are going to learn how to insert a string at a position in another string. JavaScript does not give a direct way to achieve this. For this, we can use the slice method. The slice method extracts a section of a string and returns a new string. In addition to the slice() method we can also use the methods join() and substr(). Using the slice() Method of the String class This slice() method gets parts of the string and returns the extracted part from the string and makes a new string. Following is the syntax ... Read More
The elements in the contiguous memory address are contained in the linear data structure known as an array. At these places, it primarily groups components of the same data type. Given an array of integers. The array is to be divided into two halves, 0s and 1s, according to the article "Segregate 0s and 1s in an array." The array should have all the 0’s on the left and all the 1’s on the right. Input-Output Scenario Let’s consider an input and its output scenarios to segregate 0’s and 1’s in an array list - Input: [0, 1, ... Read More
In this article we are going to learn how to clear the JavaScript Console in Google Chrome. We have various methods to clear the console; but our question is why do we need to clear the console? Sometimes we have lots of commands and logs printed in any browser console which makes it look substandard and packed with output. So, we need to clear the console. And there are multiple ways to clear the console of google chrome. Using the console.clear() method This method will clear the console and display the message on the console that the console was clear. ... Read More
In this article, we are going to discuss how to create keys in a JavaScript associative array dynamically. Associative arrays are dynamic objects that are user defined as needed. When you assign values to keys in a variable of types array, then the array is transformed into an object, and it loses the attributes and methods or array. i.e. the length attributes have no effect because the variables are no longer of the type array. JavaScript associative arrays are same as any other literals. You can add keys to these using the square brackets notation you can add keys to ... Read More
In this article we will discuss about how a variable scope works in Python function. The scope of a name is the area of a program in which you can clearly access a name, such as variables. Hence, a variable scope is the region in which we can access a variable as shown in the following example - def multiplication(): product = 7*9 Here, the “product” variable is created inside the function, therefore it can only be accessed within it. In general, the python scope concept is presented using the rule called as the ... Read More
Ember.js is the best framework. The user of Ember.js is increasing day by day. The popularity of ember.js is 6.3% of JavaScript developers currently using ember. Its popularity has stood over the last two years. Ranked 4th most popular JavaScript framework. Ember.js is an MVVM (Model−view−view−model) model framework for complex and multiple-page applications and it is an open-source framework. It is a very redefined control system that helps you to integrate with the new version without any problems. Ember.js is a free javascript client-side framework it is used for developing web applications. It is providing the complete solution which contains ... Read More
The preload attribute specifies how the author thinks about the media file should be loaded when the page loads. The preload attributes allow the author to provide hints to the browser about how much time should take to load a page, it will lead to the best user experience. Preload also tells the browser about critical resources that you want to load as soon as possible. This is especially useful for resources that are not easily appreciable, such as fonts included in stylesheets, background images, or resources loaded from a script. Using preload helps here because the images start loading ... Read More
We can set a countdown timer in JavaScript using the setInterval() method. This method continuously calls a function or executes a code snippet with a fixed time delay between every call. The setInterval() method calls a function at described intervals in milliseconds. It continues calling the function until the clearInterval() is called, or the window is closed. SyntaxFollowing is the syntax of this method − setInterval(function, milliseconds); The setInterval method accepts two parameter functions and milliseconds. function − A function containing a block of code designed to perform a particular task. milliseconds − it is the time interval ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP