The perimeter of a triangle is the sum of the lengths of its three sides. You can find the perimeter of a triangle using JavaScript by finding the sum of all sides of the triangle, as the perimeter of the triangle refers to the sum of all three sides of the triangle, i.e., perimeter = a + b + c. To find the perimeter of a triangle using JavaScript, we need to write a function that calculates the sum of three sides of a triangle and returns the triangle's perimeter as an output. In this article, we will understand the ... Read More
A foreign key is a field (or collection of fields) in one table that refers to the primary key in another table. The table containing the foreign key is called the child table, and the table containing the primary key is called the parent table. A foreign key ensures that the value in the foreign key column must match a value in the primary key column of the referenced table, maintaining referential integrity between the two tables. Characteristics of a Foreign Key A foreign key creates a relationship between two tables. ... Read More
In this article, we will learn about the difference between a method and a function in Javascript. Method and a function are the same, with different terms. A method is a procedure or function in object-oriented programming. What is a Function? A function is a group of reusable code that can be called anywhere in your program. This removes the necessity to repeat the same code over and over, assisting developers in writing modular code. JavaScript functions can be defined in a number of ways, such as function expressions, arrow functions, or the function keyword. The following is the syntax ... Read More
One of the major strengths of JavaScript is that it does not require any expensive development tools. You can start with a simple text editor such as Notepad. Since it is an interpreted language inside the context of a web browser, you don't even need to buy a compiler. To make our lives simpler, various vendors have come up with very nice JavaScript editing tools. Some of them are listed here − Code Editors and IDEs A quality code editor is the backbone of any JavaScript development process. Visual Studio Code (VS Code) is a ... Read More
In Java, objects may be initialized in various ways for different purposes. When a class is implementing the Cloneable interface, it opens up one more way of creating object instances. What is Cloneable Interface? Cloneable interface in Java states that a class can clone its objects. It enables the class to make a copy of itself using the clone() method. If the class is not Cloneable, the clone() method called on its object would throw an error. Different Approaches Consider a class Tester that has implemented a Cloneable interface. Now you can initialize an object using the following three ways ... Read More
Before getting into the ways of creating a file using Bash, let's first understand how Linux treats its files. Linux organizes all its data into files and files are organized into directories. Further, the directories are organized into tree-like structures called the file system. When you have to work in a Linux environment, you would definitely have to spend a lot of your time working on different types of files. There are several different ways in which one can create a file in Linux. You can create a file from the Bash Shell or you can use the Desktop File ... Read More
In JavaScript, to search for an object key in a Set, you need to understand how Sets store values and how objects behave in JavaScript. JavaScript Sets are useful objects that store unique values, making them excellent for handling distinct data. In this article, we'll explore different ways to search for an object key in a Set. JavaScript Set A Set in JavaScript is a collection of unique values. Values like numbers and strings can be compared directly, but objects are stored by reference. This means that even if two objects have the same properties, they are still seen ... Read More
The compile() method in JavaScript is a lesser-known method that has been associated with two main contexts: compiling regular expressions and validating JavaScript syntax. This method has been deprecated since JavaScript version 1.5. But developers must know about this. What is the compile() Method? The compile() method allows developers to update an existing regular expression (RegExp) object with a new pattern and flags. This is helpful when you need to change a regular expression without making a new object. Syntax and Parameters Here is the basic syntax for this: RegExpObject.compile(pattern, flags) Let's understand the parameters used with ... Read More
Extracting text enclosed in quotation marks is a common task in programming, especially when working with strings that include quotes. In JavaScript, strings are a data type used to represent text. A string is a sequence of characters enclosed in single quotes ('), double quotes ("), or backticks (`). In JavaScript, strings are a data type used to represent text. JavaScript provides multiple ways to extract text enclosed in quotation marks. This article explains how to extract words or phrases inside quotations from a string efficiently. Extracting text enclosed in quotation marks Extracting text enclosed in quotation marks can ... Read More
When working with JavaScript, handling keyboard events and creating a program that gets a variable to count up/down on keyboard press can be an essential skill. Keyboard events such as keydown and keyup in JavaScript are actions that occur when a user interacts with the keyboard. This article explains how to create a JavaScript program that increments or decrements a variable based on specific keyboard key presses. This feature can be helpful in interactive websites, like games or tools that check user input. Table of Content You can create a JavaScript program to get a variable to count up ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP