
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10483 Articles for Web Development

823 Views
ProblemWe are required to write a JavaScript class that have to member functions −toHex: It takes in a ASCII string and returns its hexadecimal equivalent.toASCII: It takes in a hexadecimal string and returns its ASCII equivalent.For example, if the input to the function is −Inputconst str = 'this is a string';Then the respective hex and ascii should be −74686973206973206120737472696e67 this is a stringExampleconst str = 'this is a string'; class Converter{ toASCII = (hex = '') => { const res = []; for(let i = 0; i < hex.length; i += 2){ ... Read More

220 Views
ProblemWe are required to write a JavaScript function that takes in two strings, str1 and str2 as the first and the second argument.Our function should sort str1 according to the order of characters as they appear in str2For example, if the input to the function is −Inputconst str1 = 'coding'; const str2 = 'gncabdi';Outputconst output = 'gncdio';Output ExplanationThe characters that appear first in str2 are placed first followed by the ones that comes later and lastly followed by the letters absent in str2.ExampleFollowing is the code − Live Democonst str1 = 'coding'; const str2 = 'gncabdi'; const sortByOrder = (str1 = ... Read More

380 Views
ProblemWe are required to write a JavaScript function that takes in a number, num, as the first and the only argumentOur function should do two thingsFirst of all, it should check whether the number is prime with 10 or not, if its not, we should return -1 (a number is prime with any other number if the only common factor they share is 1).If the number is prime with 10, then we should return the length of the decimal part which repeats itself, when that very number divides 1.For example, if the input to the function is −Inputconst num = ... Read More

91 Views
ProblemWe are required to write a JavaScript function that takes in an array of positive integers, arr, as the first and the only argument.Our function should first join the numbers present in the array and find the single number represented by the array and then return a new array that represents the number which is greater than the input array number by a magnitude of 1.For example, if the input to the function is −Inputconst arr = [6, 7, 3, 9];Outputconst output = [6, 7, 4, 0];Output ExplanationBecause the number represented by input array is 6739 and the required number ... Read More

600 Views
ProblemWe are required to write a JavaScript function that takes in a string of uppercase English alphabets, str, as the first and the only argument.Consider the following mapping between English and Greek letters −A=α (Alpha) B=β (Beta) D=δ (Delta) E=ε (Epsilon) I=ι (Iota) K=κ (Kappa) N=η (Eta) O=θ (Theta) P=ρ (Rho) R=π (Pi) T=τ (Tau) U=μ (Mu) V=υ (Upsilon) W=ω (Omega) X=χ (Chi) Y=γ (Gamma)For all the alphabets that have a Greek mapping our function should create a new string in which the English letter is replaced by corresponding Greek letter and if there exists no mapping we should persist ... Read More

623 Views
ProblemWe are required to write a JavaScript function that takes in an array of integers, arr, as the first and the only argument.The array either consists of all even numbers and just one odd number or consists of all odd numbers and just one even number. Our function should return this one different element from the array.For example, if the input to the function is −Inputconst arr = [5, 9, 7, 11, 34, 23, 77];Outputconst output = 34;Output ExplanationBecause the array consists of all odd numbers but 34 which is even.ExampleFollowing is the code − Live Democonst arr = [5, 9, ... Read More

151 Views
Arithmetic ProgressionArithmetic Progression (AP) is a sequence of numbers such that the difference of any two consecutive numbers is a constant value (aka common difference).For instance, 1, 2, 3, 4, 5, 6, … is an AP, which has a common difference equal to 1 (2 -1).ProblemWe are required to write a JavaScript function that takes in an array of integers, arr, as the first and the only argument.The task of our function is to return the number of arithmetic progressions of size 3 that are possible from that list. In each progression, the differences between the elements must be the ... Read More

172 Views
ProblemWe are required to write a JavaScript function that takes in a number, num, as the first and the only argument.Our function should compute and return the number of digits in the factorial of the number num.For example, if the input to the function is −Inputconst num = 7;Outputconst output = 4;Output ExplanationBecause the value of 7! Is 5040 which contains 4 digits.ExampleFollowing is the code − Live Democonst num = 7; const countDigits = (num = 1) => { let res = 0; while(num >= 2){ res += Math.log10(num); num--; }; return ~~res + 1; } console.log(countDigits(num));Output4

571 Views
ProblemWe are required to write a JavaScript function that takes in an array of integers, arr, as the first and the only argument.Our function is required to pick and return one such index from the array such that the sum of elements on its left side is equal to the sum of elements on its right side. If there exists no such index in the array, we should return -1.For example, if the input to the function is −Inputconst arr = [1, 2, 3, 4, 3, 2, 1];Outputconst output = 3;Output ExplanationBecause the sum of elements at either side of ... Read More

214 Views
ProblemWe are required to write a JavaScript function that takes in a string, str, as the first and the only argument.Our function should create a new string based on the input string where each character in the new string is '(' if that character appears only once in the original string, or ')' if that character appears more than once in the original string.And we should ignore capitaliFor example, if the input to the function is −Inputconst str = 'Success';Outputconst output = ')())())';ExampleFollowing is the code − Live Democonst str = 'Success'; const mapString = (str = '') => { ... Read More