Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Prerna Tiwari
Page 2 of 2
How to create a private variable in JavaScript?
Closures, Symbols, WeakMaps, class private fields, and Proxies are a few techniques that can be used to create a private variable in JavaScript. Every technique has benefits and drawbacks, so it's crucial to pick the one that best suits your requirements. Like many other programming languages, JavaScript has the idea of private and public variables. Private variables can only be accessed and changed by code that is also part of the same scope, but public variables can be accessed and changed by any code. Let’s look at the different techniques to create a private variable in JavaScript. Using ...
Read MoreHow to create a global Promise Rejection Handler in JavaScript?
Promise rejection handlers are a powerful tool in JavaScript for handling errors that occur in asynchronous code. In this article, we will learn how to build a global promise rejection handler in JavaScript and how it might assist your application manage errors. You can detect unhandled promise rejections using the global unhandledrejection event and take the necessary action, like logging the problem to an error tracking service or showing the user a notice. A more understandable and simpler syntax for handling promise rejection is provided by error handling with async-await, but it necessitates that you wrap each async function ...
Read MoreHow to create a function from a string in JavaScript?
Creating a function from a string in JavaScript can be helpful in situations when you need to generate a function dynamically at runtime or when you have a string that contains the code for a function you wish to execute. The ability to construct a function from a string is a useful functionality of JavaScript that allows dynamic function creation at runtime. The eval() function and the new Function() function Object() [native code] are the two most popular methods for doing this, although both have significant security flaws. The Function.prototype.constructor is a safer option even though it is ...
Read MoreHow to convert a plain object into ES6 Map using JavaScript?
There are many ways to convert a plain object into an ES6 Map in JavaScript. The simplest and most effective way is using the Object.entries() function and the Map() constructor. In contrast, the more flexible alternatives include Object.keys() and Array.prototype.forEach() and the for...in loop and Map() function method. A Map in ES6 is a collection of key-value pairs. Here we can use any type of object as a key, including primitive data types like strings and numbers. The values in the map can be any type of object. The main difference between a Map and an object is that ...
Read MoreHow to convert a pixel value to a number value using JavaScript?
Converting pixel values to number values in JavaScript is a simple task that can be accomplished using built-in functions such as parseInt(), parseFloat(), Number() and also string method replace(). Each method has its own advantages and disadvantages and the best method to use will depend on the specific requirements of your project. When positioning and styling items on a web page, it's sometimes required to work with both pixel and numeric values in web development. To execute computations or operations on a value, for instance, you might need to convert a pixel value, such as "100px, " to a ...
Read MoreHow to convert a number into an array in JavaScript?
In JavaScript, there are many built-in methods that can convert a number into an array. The simplest one is to the split() method. We can also use the map(), reduce(), or form() methods to perform the task. Some of the most popular methods for converting a number into an array are discussed in this article, along with examples of when and how to apply each technique. Now, the question will be, why there can be a need to convert a number into an array? Then the reason could be splitting a phone number into its individual digits or breaking own ...
Read MoreForm required attribute with a custom validation message in HTML5
HTML5 includes a number of built-in form validation features that allow developers to easily add validation to their forms. One of these features is the "required" attribute, which specifies that an input field is required and must be filled out before the form can be submitted. The “required” attribute is a boolean attribute. If any input field with the “required” attribute is present in the form, then this field must be completed before submitting the form. If that particular field is left blank before submitting the form, the user will see an error message from the browser informing ...
Read MoreSoftware Engineering for Data Scientists in Python
Data science integrates math and statistics, specialized programming, advanced analytics, machine learning, and artificial intelligence (AI) with specific subject matter expertise to reveal actionable insights hidden in an organization’s data. Data science is one of the fields which has shown the quickest growth rates across all industries. This is a result of the increasing volume of data sources and data that results from them. Data Science has generated controversy among other disciplines as a field ever since it began to gain recognition. In this article we will be learning about the fundamentals of software engineering, why it ...
Read MorePython for MATLAB Users
When we move from our academics into the industry, especially engineering individuals, we face a very common problem that we are mainly taught about the obsolete or near obsolete technologies. For example, many schools still use MATLAB. In the engineering sector, whether it is chemical engineer, electrical engineer, or nanoengineer, everyone must have used MATLAB. But in recent times, we can see businesses are shifting from MATLAB to Python. This can be due to a variety of reasons − $1000 licensing cost Inefficient memory allocation Dearth of open source libraries Detest MATLAB syntax. The people who want ...
Read MoreParallel Computing with Dask
Dask is a flexible open-source Python library which is used for parallel computing. In this article, we will learn about parallel computing and why we should choose Dask for this purpose. We will compare it with various other libraries like spark, ray and modin. We have also discussed use cases of Dask. Parallel Computing A type of computation known as parallel computing carries out several computations or processes simultaneously. Large issues are typically divided into manageable pieces that may be solved separately. The four categories of parallel computing are Bit-level Instruction-level Data-level Job parallelism. ...
Read More