Difference Between Connection-Oriented and Connection-Less Services

Kiran Kumar Panigrahi
Updated on 22-Aug-2022 11:29:57

5K+ Views

Connection-oriented and Connection-less Services are used to establish connections between two or more devices. Connection-oriented Services A connection-oriented service is one that establishes a dedicated connection between the communicating entities before data communication commences. It is modeled after the telephone system. To use a connection-oriented service, the user first establishes a connection, uses it and then releases it. In connection-oriented services, the data streams/packets are delivered to the receiver in the same order in which they have been sent by the sender. Connection-oriented services may be done in either of the following ways − Circuit-switched connection: In circuit ... Read More

Convert Decimal Number to Roman Using JavaScript

Shubham Vora
Updated on 22-Aug-2022 09:25:10

849 Views

Roman numerals are a type of number system used to represent a fixed decimal number. Several letters from the Latin alphabet are used for the representation of roman numerals. In this tutorial, the user will learn how to convert a decimal number to roman using JavaScript. Seven symbols represent Roman numerals: I, V, X, L, C, D, and M. The values for symbols are given below. Syntax I is 1 V is 5 X is 10 L is 50 C is 100 D is 500 M is 1000 Using these seven symbols user can convert decimal numbers to roman. ... Read More

How and Why Does 'z' in JavaScript Work

Shubham Vora
Updated on 22-Aug-2022 09:04:13

280 Views

In this tutorial, we will learn how and why ‘z’[‘toUpperCase’]() works in JavaScript. From the given format, we can say that it calls the toUpperCase() method for the ‘z’ string. It will work the same as the toUpperCase() method, which we invoke by taking any string as a reference. Let’s understand the syntax of the ‘z’[‘toUpperCase’]() below. Syntax let result = 'z'['toUpperCase'](); // returns 'Z', string in upper case The above syntax is same as the below. Example let string = 'z'; let result = string.toUpperCase(); Why does ‘z’[‘toUpperCase’]() work? In JavaScript toUpperCase() method is used to convert ... Read More

Declare JavaScript Variables as Specific Types

Shubham Vora
Updated on 22-Aug-2022 08:58:59

3K+ Views

In this tutorial, we will see if we can declare JavaScript variables as a specific type or not. The JavaScript contains the three reserve keywords to declare the variables: ‘let, ’ ‘var’, and ‘const.’ When the user declares the variable using any keyword, it has a different scope. The variable declared with the const keyword always remains constant, and we can’t change its value after initializing it. The variables declared with the let keyword have block scope and can’t be accessed outside its scope. When we declare the variables with the var keyword, it can have the global scope or ... Read More

Convert Unicode Values to Characters in JavaScript

Shubham Vora
Updated on 22-Aug-2022 08:51:03

6K+ Views

In this tutorial, we will learn to convert Unicode values to characters in JavaScript. The Unicode values are the standard values for the character, and users can encode them to convert them into characters. For example, ‘A’ is a Unicode character whose value is 65 according to the ASCII (American standard code for information interchange) table. In the same way, all alphabets, numbers, and other characters have particular Unicode values. We will learn to identify the Unicode character from its values using JavaScript. Using the fromCharCode() Method In JavaScript, the string library contains the fromCharCode() method, which takes the decimal ... Read More

Convert Array to JavaScript String

Shubham Vora
Updated on 22-Aug-2022 08:43:41

8K+ Views

An array is the most popular and adaptable data structure you might employ in your regular programming. Predefined methods and a few more techniques make converting an array into a string simple. The process of converting an array into a JavaScript String can be done in several methods, and in this article, we will be looking at them. Using the toString() Method Using the join() Method Using JSON.stringify() Method Using the Type Coercion Using the toString() Method There is an internal function toString(). It is a built-in JavaScript method that can be applied to any JavaScript variable. The ... Read More

Add 30 Minutes to a JavaScript Date Object

Saurabh Jaiswal
Updated on 22-Aug-2022 08:30:54

12K+ Views

In this tutorial, we will learn how to add 30 minutes to a JavaScript Date object. Here we will discuss two methods which are following. Using the setMinutes( ) Method Using the getTime() Method Using the setMinutes Method The setMinutes() function of the date object accepts an integer representing the Minutes and replaces the value of the Minutes in the current date with it. Syntax Date.setMinutes(min, sec, ms); Parameter min − An integer between 0 and 59, representing the minutes. sec − An integer between 0 and 59, representing the seconds. If you specify the sec ... Read More

Add Number of Days to JavaScript Date

Saurabh Jaiswal
Updated on 22-Aug-2022 08:21:05

19K+ Views

In this tutorial, we will learn how to add a number of days to a JavaScript Date object. Here we will discuss two methods which are following. Using the setDate( ) Method Using the getTime() Method Using the setDate( ) Method JavaScript date setDate() method sets the day of the month for a specified date according to local time. Syntax Its syntax is as follows − Date.setDate( dayValue ) Here dayValue is an integer from 1 to 31, representing the day of the month. Approach To add a number of days to the current date, first we ... Read More

Add New Array Elements at the Beginning of an Array in JavaScript

Saurabh Jaiswal
Updated on 22-Aug-2022 08:17:40

491 Views

We will learn how to add new array elements at the beginning of an array in JavaScript. To achieve this in JavaScript we have multiple ways, a few of them are following. Using the Array unshift() Method Using the Array splice() Method Using ES6 Spread Operator Using the Array unshift() Method The array unshift() method in JavaScript is used to add new elements at the start of the array. This method changes the original array by overwriting the elements inside it. Syntax arr.unshift(element1, element2, . . . . . . , elementN) Parameter element1, element2, …, ... Read More

Add Multiple Event Handlers to the Same Element with JavaScript

Saurabh Jaiswal
Updated on 22-Aug-2022 08:12:29

13K+ Views

It is very common to use the events while we are programming in JavaScript. Suppose you are creating a modal that opens up on clicking a button or hovering over using the cursor, here we using two events on a single element but JavaScript does not have any official way to use many event listeners on a single element. In this article, we will learn How to add many Event Handlers to the same element with JavaScript HTML DOM. To achieve this, we have the following approaches given below. Using Multiple addEventListener Methods Using the ES6 Way Using ... Read More

Advertisements