Remove All Child Elements of a DOM Node in JavaScript

Arnab Chakraborty
Updated on 11-Aug-2022 10:45:43

14K+ Views

Suppose you are building a web app that manages the data of daily tasks, the user inserts the task and a list of tasks gets formed. But at some point in time, the user wants to remove all the tasks from the list and wants to make the list empty. So, as a developer, you should know how to remove all the child elements from the DOM node. To remove all the elements from the DOM node we have the following approaches. By iterating the DOM nodes and using the removeChild method. By Erasing the innerHTML value to a ... Read More

Count Vowels Using Set in a Given String - Python Program

AmitDiwan
Updated on 11-Aug-2022 09:47:59

1K+ Views

We will count the number of vowels using set in a given string. Let’s say we have the following input − jackofalltrades The output should be the following, counting the number of vowels − 65 Count the number of vowels using set in a given string We will count the number of vowels using set in a give string − Example def vowelFunc(str): c = 0 # Create a set of vowels s="aeiouAEIOU" v = set(s) # Loop to traverse the alphabet in the given string for alpha in str: # If alphabet is present # in ... Read More

Check If Two Lists Have At Least One Common Element in Python

AmitDiwan
Updated on 11-Aug-2022 09:46:25

2K+ Views

To check if two lists have at least one common element, we will loop through list1 and list2 and check for atleast one common element in both the lists. The list is the most versatile datatype available in Python, which can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type. Let’s say we have the following inputs i.e. 2 lists − [15, 45, 67, 30, 98] [10, 8, 45, 48, 30] The output should be the following ... Read More

Difference Between Spoofing and Phishing

Kiran Kumar Panigrahi
Updated on 11-Aug-2022 09:12:58

7K+ Views

Spoofing is an identity theft where a person tries to use the identity of a legitimate user. Phishing, on the other hand, is a phenomenon where an attacker employs social engineering methods to steal sensitive and confidential information from a user. Spoofing and phishing are both forms of cyber-attacks aimed at tricking you into disclosing your personal information. Both methods will be used by a criminal to gain your user names, passwords, and maybe more. Despite the fact that their final aim is the same, their techniques are not. Read through this article to find out more ... Read More

Difference Between Router and Modem

Kiran Kumar Panigrahi
Updated on 11-Aug-2022 09:03:38

3K+ Views

Both Routers and Modems are network connecting devices. Routers work at the network layer and are responsible to find the shortest path for a packet, whereas Modems connect a device like desktop, laptop to the Internet. Routers connect devices across multiple networks. Read through this article to find out more about Routers and Modems and how they are different from each other. What is a Modem? A modulator-demodulator, or a modem, is a piece of hardware that transforms data from a digital format designed for direct communication between devices using specific cabling into a format suitable for transmission via ... Read More

Find Row with Maximum Number of 1s using Map Function in Python

AmitDiwan
Updated on 11-Aug-2022 09:03:32

343 Views

In this article, we will learn how to use map function to find row with maximum number of 1's. 2D array is given and the elements of the arrays are 0 and 1. All rows are sorted. We have to find row with maximum number of 1's. Here we use map (). The map function is the simplest one among Python built-ins used for functional programming. These tools apply functions to sequences and other iterables. Let’s say the input is the following array − [[0, 1, 1, 1, 1], [0, 0, 1, 1, 1], [1, 1, 1, 1, 1], [0, ... Read More

Difference Between Router and Gateway

Kiran Kumar Panigrahi
Updated on 11-Aug-2022 09:01:54

7K+ Views

Both Routers and Gateways are network connecting devices. Routers work at the network layer and are responsible to find the shortest path for a packet. Routers connect devices across multiple networks. Gateways, in contrast, function as a node that serves as a gateway to a network's other nodes. Read through this article to find out more about Routers and Gateways and how they are different from each other. What is a Router? A router is basically a network connecting device that determines the quickest path for a packet to go to its destination. The primary objective of using a router ... Read More

Sort a List According to the Second Element in the Sublist

AmitDiwan
Updated on 11-Aug-2022 08:56:19

1K+ Views

In this article, we will sort a list according to the second element in the sublist. Let’s say we have the following list − [['jack', 50], ['antony', 20], ['jones', 87], ['gary', 70], ['tom', 90], ['sam', 110], ['warner', 65]] The output should be the following i.e. sorted according to the second element − [['antony', 20], ['jack', 50], ['warner', 65], ['gary', 70], ['jones', 87], ['tom', 90], ['sam', 110]] Python program to sort a list according to the second element in the sublist using the sort() method Example # Custom Function def SortFunc(sub_li): sub_li.sort(key = lambda x: x[1]) return sub_li ... Read More

Difference Between Router and Bridge

Kiran Kumar Panigrahi
Updated on 11-Aug-2022 08:55:37

15K+ Views

Both Routers and Bridges are network connecting devices. Routers work at the network layer and are responsible to find the shortest path for a packet, whereas Bridges connect various devices in a network. Routers connect devices across multiple networks. Read through this article to find out more about routers and bridges and how they are different from each other. What is a Router? A router is a networking device that receives, processes, and sends data packets from one computer network to another. On the Internet, routers are in charge of traffic steering. Data packets are used to send data across ... Read More

Count Elements in a List Until an Element is a Tuple in Python

AmitDiwan
Updated on 11-Aug-2022 08:53:33

602 Views

In this article, we will count the elements in a list until an element is a Tuple. The list is the most versatile datatype available in Python, which can be written as a list of commaseparated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type. A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The main difference between the tuples and the lists is that the tuples cannot be changed unlike lists. Tuples use parentheses, whereas lists use square ... Read More

Advertisements