AmitDiwan has Published 10744 Articles

Difference Between Hypertext and Hypermedia

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 07:33:28

6K+ Views

In this post, we will understand the difference between hypertext and hypermedia −HypertextIt refers to the system of managing the information related to the plain text.It involves only text.It becomes a part of the link.It is the part of hypermedia.It allows the user to traverse through text in a non-linear ... Read More

Counting number of triangle sides in an array in JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 07:06:11

219 Views

ProblemWe are required to write a JavaScript function that takes in an array of numbers, arr, as the first and the only argument.The task of our function is to count the number of triplets chosen from the array that can make triangles if we take them as side lengths of ... Read More

Constructing an array of addition/subtractions relative to first array element in JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 07:01:55

136 Views

ProblemWe are required to write a JavaScript function that takes in an array of positive integers. Our function should map this array to an array of string integers.The array should contain the number we should add/subtract to the first element to achieve the corresponding element.For example[4, 3, 6, 2]should return ... Read More

Changing second half of string number digits to zero using JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 07:01:02

188 Views

ProblemWe are required to write a JavaScript function that takes in a string number as the only argument.Our function should return the input number with the second half of digits changed to 0.In cases where the number has an odd number of digits, the middle digit onwards should be changed ... Read More

Rotate number to form the maximum number using JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 07:00:42

163 Views

ProblemWe are required to write a JavaScript function that takes in a number n. Our function is required to return the maximum value by rearranging its digits.ExampleFollowing is the code −const num = 124; const rotateToMax = n => {    n = n       .toString()     ... Read More

Sorting and find sum of differences for an array using JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 07:00:27

350 Views

ProblemWe are required to write a JavaScript function that takes in an array of integers. Our function should sum the differences between consecutive pairs in the array in descending order.For example − If the array is −[6, 2, 15]Then the output should be −(15 - 6) + (6 - 2) ... Read More

Is the digit divisible by the previous digit of the number in JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 07:00:06

205 Views

ProblemWe are required to write a JavaScript function that takes in a number and checks each digit if it is divisible by the digit on its left and returns an array of booleans.The booleans should always start with false because there is no digit before the first one.ExampleFollowing is the ... Read More

Generating desired pairs within a range using JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 06:59:46

227 Views

ProblemWe are required to write a JavaScript function that takes in a number n. Our function should generate an array containing the pairs of integers [a, b] that satisfy the following conditions −0

Finding the 1-based index of a character in alphabets using JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 06:58:32

204 Views

ProblemWe are required to write a JavaScript function that takes in a lowercase English alphabet character. Our function should return the character’s 1-based index in the alphabets.ExampleFollowing is the code − Live Democonst char = 'j'; const findCharIndex = (char = '') => {    const legend = ' abcdefghijklmnopqrstuvwxyz';   ... Read More

Implementing a custom function like Array.prototype.filter() function in JavaScript

AmitDiwan

AmitDiwan

Updated on 21-Apr-2021 06:52:46

910 Views

ProblemWe are required to write a JavaScript function that lives on the prototype Object of the Array class.Our function should take in a callback function as the only argument. This callback function should be called for each element of the array.And that callback function should take in two arguments the ... Read More

Advertisements