![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 9326 Articles for Object Oriented Programming
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
112 Views
We are required to write a JavaScript function that takes in an array of Numbers as the first argument and a single number as the second argument.The function should find and return that number from the array which is closest to the number specified by the second argument.For example −const arr = [34, 67, 31, 53, 89, 12, 4]; const num = 41;Then the output should be 34.ExampleFollowing is the code −const arr = [34, 67, 31, 53, 89, 12, 4]; const num = 41; const findClosest = (arr = [], num) => { let curr = arr[0]; ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
123 Views
In the given problem statement we are required to check if the string ends with the desired character with the help of Javascript functionalities. So we will use basic functions and syntax of Javascript to solve the problem. Understanding the problem The problem at hand is to check if a given string is ending with the given specific character in Javascript. For example suppose we have a string as Hello World! and we have to check if the exclamation ‘!’ mark is present at the end of the string or not. So after comparing with the string the ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
514 Views
In the given problem statement we have to find the difference between sum of square and square of sum with the help of Javascript functionalities. So we will use basic Javascript to solve this problem. Understanding the Problem The problem at hand is to compare the two integers given. This operation is a common operation when it comes to sorting the data. In this task we will find how to compare two integers and check their relationship with the help of Javascript. For example, we have two integers like 10 and 20. So we can say that 10 ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
451 Views
In the given problem statement we are required to find the common characters count for the given strings with the help of Javascript functionalities. So we will use basic Javascript to solve this problem. Understanding the problem The problem at hand is to find the common characters between the two given strings. So for solving this problem we will determine how many characters they have in common. For example suppose we have two strings like "abaac" and "baaaa" so in these two strings we can see there are 2 common characters which are 'a' and 'b'. So the ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
2K+ Views
In the given problem statement we are required to get the century from the given year with the help of Javascript functionalities. So we will use the basic functions of Javascript to solve this problem. Understanding the Problem The problem at hand is to find the century number of the given input year. So basically we have to create an algorithm for finding the century number corresponding to the given year. So first understand what the century number is! A century represents a period of 100 years, beginning from the year 1. For example, the 20th century ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
486 Views
In the given problem statement we have to find that the string is a palindrome and the string should also have punctuation and write code with the help of Javascript functionalities. Understanding the problem The problem at hand is to explore how to determine whether a given string is a palindrome or not with the help of Javascript. So let's see what palindrome is first. A palindrome is a word, phrase, a number or a sequence of letters which can be read the same forward and backward. For example: racecar is a palindrome string. Logic ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
654 Views
In the given problem statement our aim is to find the maximum sum of n consecutive items of array with the help of Javascript functionalities. So for solving this problem we will use basic Javascript functionalities and produce the maximum sum. Understanding the Problem The problem at hand is to find the maximum sum of n consecutive items in the array. This process will involve identifying a continuous subarray of length n within the given array which has the highest possible sum. For example suppose we have an array as [1, 2, 4, 7, 3, 5] so that ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
1K+ Views
In the given problem statement our aim is to shift every letter in the given string N places down in the alphabet with the help of Javascript functionalities. So we will use some basic Javascript methods to complete the given task. Understanding the Problem The problem at hand is to shift the character of the given string up to the N places down in the alphabets with the help of Javascript. The purpose of this problem is we need to take a string as input and we have to update the given string by shifting every letter N ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
303 Views
In the given problem statement we have to get an almost increasing sequence of integers with the help of Javascript functionalities. So we will use some basic functionalities of mathematics and Javascript. Understanding the problem The problem at hand is to generate an almost increasing series of integers in Javascript. So the almost increasing sequence is a sequence in which every item is greater than or equal to the previous item. In other terms we will say it allows for a single item in the sequence where an item is smaller than the previous item. So the resultant ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
4K+ Views
In the given problem statement our task is to find the nth prime number with the help of Javascript functionalities. So we will use two functions to solve this problem. Understanding the Problem The problem at hand is to find the nth prime number using the Javascript programming. So the prime number is a positive integer number which is greater than 1 and which has no positive divisors other than 1 and the number itself. The task is to create a Javascript function which takes an input n. Here n represents the position of the prime number which ... Read More