JavaScript Programs Last Updated : 26 Apr, 2024 Improve Improve Like Article Like Save Share Report JavaScript Programs contains list of articles based on programming. This article contains wide collection of programming articles based on Numbers, Maths, Arrays, Strings, …, etc. that are mostly asked in interviews. Table of Content Basic Programs Number Programs Math Programs Array Programs String Programs Linked List Programs Object Programs Date Programs Set and Map Programs JavaScript Basic Programs This section contains basic programming articles for beginners level. S. No. Articles 1 JavaScript Program to Add Two Numbers 2 JavaScript Program for Multiplication of Two Numbers 3 JavaScript Program to Add Float Numbers 4 JavaScript Program to Check if a Number is Odd or Even 5 JavaScript Program to Check if a number is Positive, Negative, or Zero 6 JavaScript Program to Swap Two Variables 7 JavaScript Program to Find the Sum of Natural Numbers 8 JavaScript Program for Armstrong Numbers 9 JavaScript Program to Check for Palindrome Number 10 JavaScript Program to Find the Area of Triangle 11 JavaScript Program to Convert Celsius to Fahrenheit JavaScript Number Programs This section contains wide collection of Number based programs. JavaScript Number contains different types of numbers and their values. S. No. Articles 1 JavaScript Program to Generate Random Number in Given Range 2 Javascript Program to Check Prime Number 3 JavaScript Program to Find Largest of Three Numbers 4 JavaScript Program to Print All Prime Numbers in an Interval 5 JavaScript Program to Check if Two Numbers have Same Last Digit 6 JavaScript Program to Guess Number 7 JavaScript Program to Split a Number into Individual Digits 8 JavaScript Program to Find the Missing Number 9 JavaScript Program to Find the Factors of a Number 10 JavaScript Program to Print All Prime Numbers in an Interval JavaScript Math Programs This section contains wide collection of Mathematical based programs. JavaScript Maths contains mathematical operation on numbers. S. No. Articles 1 JavaScript Program to Compute Power of a Number 2 JavaScript Program to Find the Square Root 3 JavaScript Program to Solve Quadratic Equations 4 Program to Convert Km/hr to miles/hr and vice versa 5 JavaScript Program for Factorial of a Number 6 JavaScript Program to Print Multiplication Table of a Number 7 JavaScript Program to Print Fibonacci Series 8 JavaScript Program to Find GCD or HCF of Two Numbers 9 JavaScript Program to Find LCM of Two Numbers 10 JavaScript Program to Find the Factors of a Number 11 JavaScript Program to Shuffle Deck of Cards 12 JavaScript Program to Display Fibonacci Sequence Using Recursion 13 JavaScript Program to Find Factorial of a Number using Recursion 14 JavaScript Program to Convert Decimal to Binary 15 JavaScript Program to Find Sum of Natural Numbers using Recursion 16 JavaScript Program to Convert a Float Number to Whole Number 17 JavaScript Program to Find the Quotient and Remainder by Dividing an Integer 18 JavaScript Program to Convert a Negative Number to Positive 19 JavaScript Program to Round off a Number to Next Multiple of 5 20 JavaScript Program to Find Factorial of a Number 21 JavaScript Program to Perform Simple Mathematical Calculation 22 JavaScript Program to Calculate nPr (Permutations) JavaScript Array Programs This section contains wide collection of articles based on array programming. JavaScript Array is a single variable that is used to store elements of different data types. JavaScript arrays are zero-indexed. S. No Articles 1 JavaScript Program to Get the First and Last Item in an Array 2 JavaScript Program to Add New Elements at the Beginning of an Array 3 JavaScript Program to Remove Elements from an Array 4 JavaScript Program to Reverse an Array 5 JavaScript Program to Empty an Array 6 JavaScript Program to Check Whether an Array Includes a Particular Value or Not 7 JavaScript Program to Insert an Item into an Array at Specific Index 8 JavaScript Program to Convert a Number into Array 9 JavaScript Program to Find the Sum of All Elements of Given Array 10 JavaScript Program to Sort Words in Alphabetical Order 11 JavaScript Program to Remove Duplicate Elements from an Array 12 JavaScript Program to Find Common Items from Two Arrays 13 JavaScript Program to Replace an Item from an Array 14 JavaScript Program to Check Object is an Array or Not 15 JavaScript Program to Generate a Range of Numbers and Characters 16 JavaScript Program to Find Duplicate Elements in an Array 17 JavaScript Program to Sort Numeric Array 18 JavaScript Program to Remove Duplicate Elements from an Array 19 JavaScript Program to Get All Unique Values (Remove Duplicates) in an Array 20 JavaScript Program to Add Elements to an Existing Array Dynamically 21 JavaScript Program to Merge Two Arrays and Remove Duplicate Items 22 JavaScript Program to Sort Array of Objects by String Property Value 23 JavaScript Program to Create Two Dimensional Array 24 JavaScript Program to Splice an Array Without Mutating the Original Array 25 JavaScript Program to Extract Value of a Property as Array from Array of Objects 26 JavaScript Program to Compare Two Arrays 27 JavaScript Program to Select a Random Element from Array 28 JavaScript Program to Create an Array using Intersection of two Arrays 29 JavaScript Program to Split an Array into Chunks 30 JavaScript Program to Convert Comma Separated String to Array 31 JavaScript Program to Copy Array Items into Another Array 32 JavaScript Program to Find the Array Index with a Value 33 JavaScript Program to Merge Two Arrays and Remove Duplicate Items 34 JavaScript Program to Count Occurrences of All Items in an Array 35 JavaScript Program to Filter the Non-unique Values in an Array 36 JavaScript Program to Get N Largest Elements from an Array 37 JavaScript Program to Clone an Array 38 JavaScript Program to find Smallest Difference Triplet from Three Arrays 39 JavaScript Program to Find Shortest Distance Between Two Words in an Array of Words 40 JavaScript Program to Find the Most Frequently Occurring Element in an Array 41 JavaScript Program to Find Maximum Profit by Buying and Selling a Share at Most Twice using Array 42 JavaScript Program to Calculate the Cumulative Sum of Elements in an Array 43 JavaScript Program to Merge Two Arrays Without Creating a New Array 44 JavaScript Program for K-th Largest Sum Contiguous Subarray 45 JavaScript Program to Construct an Array from its pair-sum Array 46 JavaScript Program to Check if an Array Contains only Unique Values 47 JavaScript Program to Find the Most Frequent Element in an Array 48 JavaScript Program for Left Rotate by One in an Array 49 Find the Rotation Count in Rotated Sorted array in JavaScript JavaScript String Programs This section contains the wilde collection of articles based on String programs. JavaScript String Object is a sequence of characters. It contains zero or more characters within single or double quotes. S. No. Articles 1 JavaScript Program to Count Words of a String 2 JavaScript Program to Check if a String Contains any Whitespace Characters 3 JavaScript Program to Reverse a String 4 JavaScript Program to Replace All Occurrences of a String 5 JavaScript Program to Check if a String Starts With Another String 6 JavaScript Program to Create Multi Line Strings 7 JavaScript Program to Format Numbers as Currency String 8 JavaScript Program to Trim a String at Beginning or Ending 9 JavaScript Program to Delete First Character of a String 10 JavaScript Program to Get the Last Character of a String 11 JavaScript Program to Convert an Object to String 12 JavaScript Program to Check Whether a String Contains a Substring 13 JavaScript Program to Compare Strings 14 JavaScript Program to Encode/Decode String to Base64 15 JavaScript Program to Replace Characters of a String 16 JavaScript Program to Check Whether a Passed String is Palindrome or Not 17 JavaScript Program to Replace Characters of a String 18 JavaScript Program to Get the Number of Occurrences of Each Letter in Specified String 19 JavaScript Program to Generate a Random String 20 JavaScript Program to Make First Letter of a String Uppercase 21 JavaScript Program to Get the Number of Vowels in a String 22 JavaScript Program to Remove Spaces from a String 23 JavaScript Program to Count String Occurrence in String 24 JavaScript Program to Compare the Case Insensitive Strings 25 JavaScript Program to Generate All Combinations of a String 26 JavaScript Program to Find Unique Characters of a String 27 JavaScript Program to Convert User Input String into Regular Expression 28 JavaScript Program to Convert Comma Separated String to Array 29 JavaScript Program to Strip All Non-numeric Characters from String 30 JavaScript Program to Convert String to Title Case 31 JavaScript Program to Remove All Non-ASCII Characters from the String 32 JavaScript Program to Convert String into Float 33 JavaScript Program to Check Whether a String Contains a Substring 34 JavaScript Program to Split Multiline String into an Array of Lines 35 JavaScript Program to Find the Longest Word Within the String 36 JavaScript Program to Get Nth Occurrence of a String 37 JavaScript Program to Replace All Dots in a String 38 JavaScript Program to Check a Given String is an Anagram of Another String 39 JavaScript Program to Check if String Follows Order of Characters Defined by a Pattern or Not 40 JavaScript Program to Extract Email Addresses from a String 41 JavaScript Program to Check if a String Contains Any Digit Characters 42 JavaScript Program to Count the Occurrences of Each Character 43 JavaScript Program to Find i’th Index Character in a Binary String Obtained After n Iterations 44 JavaScript Program to find Smallest and Largest Word in a String 45 JavaScript Program to Find Minimum Number of Manipulations to Make Two Strings Anagram Without Deletion of Character 46 JavaScript Program to Get All Substrings of the Given String JavaScript Linked List Programs This section contains wide collection of articles based on Liked list data structure in JavaScript. A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. S. No. Articles 1 JavaScript Program to Implement a Linked List 2 JavaScript Program For Searching An Element In A Linked List 3 JavaScriptt Program For Inserting A Node In A Linked List 4 JavaScript Program For Inserting Node In The Middle Of The Linked List 5 JavaScript Program For Writing A Function To Delete A Linked List 6 JavaScript Program For Deleting A Linked List Node At A Given Position 7 JavaScript Program For Finding Length Of A Linked List 8 JavaScript Program For Rotating A Linked List 9 JavaScript Program For Making Middle Node Head In A Linked List 10 JavaScript Program For Removing Duplicates From An Unsorted Linked List 11 JavaScript Program For Swapping Nodes In A Linked List Without Swapping Data 12 JavaScript Program To Delete Middle Of Linked List 13 JavaScript Program To Delete Alternate Nodes Of A Linked List 14 JavaScript Program For Finding Intersection Point Of Two Linked Lists 15 JavaScript Program For Finding The Middle Element Of A Given Linked List 16 JavaScript Program For Cloning A Linked List With Next And Random Pointer In O(1) Space 17 JavaScript Program For Cloning A Linked List With Next And Random Pointer-Set 2 18 JavaScript Program For Reversing Alternate K Nodes In A Singly Linked List 19 JavaScript Program For Deleting A Given Node In Linked List Under Given Constraints 20 JavaScript Program For Alternating Split Of A Given Singly Linked List- Set 1 21 JavaScript Program For Reversing A Linked List In Groups Of Given Size – Set 1 22 JavaScript Program For Reversing A Linked List In Groups Of Given Size- Set 2 23 JavaScript Program For Writing A Function To Get Nth Node In A Linked List 24 JavaScript Program For Rearranging A Given Linked List In-Place 25 JavaScript Program To Check If Two Linked Lists Are Identical 26 JavaScript Program For Selecting A Random Node From A Singly Linked List 27 JavaScript Program For Removing Duplicates From A Sorted Linked List 28 JavaScript Program For Pointing Arbit Pointer To Greatest Value Right Side Node In A Linked List 29 JavaScript Program For Removing Every K-th Node Of The Linked List 30 JavaScript Program For Finding The Length Of Loop In Linked List 31 JavaScript Program For Segregating Even And Odd Nodes In A Linked List 32 JavaScript Program For Adding 1 To A Number Represented As Linked List 33 JavaScript Program For Adding Two Numbers Represented By Linked Lists- Set 2 34 JavaScript Program To Check If A Singly Linked List Is Palindrome 35 JavaScript Program To Find Decimal Equivalent Of Binary Linked List 36 JavaScript Program To Multiply Two Numbers Represented By Linked Lists 37 JavaScript Program For Insertion Sort In A Singly Linked List 38 JavaScript Program For Merge Sort Of Linked Lists 39 Javascript Program For Finding Intersection Point Of Two Linked Lists 39 JavaScript Program to Implement Doubly Linked List 40 JavaScript Program to Traverse Doubly Linked List 41 JavaScript Program For Insert Operation in Doubly Linked List 42 JavaScript Program For Rotate Doubly linked list by N nodes 43 JavaScript Program For Deleting A Node In A Doubly Linked List 44 JavaScript Program For Delete Operations in Doubly Linked List 45 JavaScript Program For Reversing A Doubly Linked List 46 JavaScript Program For Quick Sort On Doubly Linked List 47 JavaScript Program For Merge Sort For Doubly Linked List JavaScript Object Programs This section contains wide collection of articles based on Object programs. JavaScript Objects are important data type and form the building blocks for modern JavaScript. S. No. Articles 1 JavaScript Program to Create Objects (4 Different Ways) 2 JavaScript Program to Iterate Over an Object 3 JavaScript Program to Add an Object to an Array 4 JavaScript Program to Create Dynamic Values and Objects 5 JavaScript Program to Get a Key in an Object by its Value 6 JavaScript Program to Find the Length of an Object 7 JavaScript Program to Check a Key Exists in Object or Not 8 JavaScript Program to Get the Last Item of Object 9 JavaScript Program to Clone an Object 10 JavaScript Program to Merge Properties of Two Objects Dynamically 11 JavaScript Program to Count Number of Keys/Properties in an Object 12 JavaScript Program to Add an Object to an Array 13 JavaScript Program to Add Key/Value Pair to an Object 14 JavaScript Program to Sort Array of Objects by String Property Value 15 JavaScript Program to Convert an Object {} to an Array [] of key-value Pairs 16 JavaScript Program to Remove Duplicates from an Array of Objects 17 JavaScript Program to Remove Objects from Associative Array 18 JavaScript Program to Convert an Object to String 19 JavaScript Program to Create an Object from Given Key-Value Pairs 20 JavaScript Program to Remove a Key from Object 21 JavaScript Program to Find Max/Min Value of an Attribute in an Array of Objects 22 JavaScript Program to Convert Two-Dimensional Array into an Object 23 JavaScript Program to Remove Blank Attributes from an Object 24 JavaScript Program to Change JSON String into an Object JavaScript Date Programs This section contains wide collection of articles based on Date object. Javascript Date object in JavaScript is used to represent a moment in time. This time value is since 1 January 1970 UTC (Coordinated Universal Time). S. No. Article 1 JavaScript Program to Subtract Days from Date Object 2 JavaScript Program to Add Hours to the Date Object 3 JavaScript Program to Convert Date to Number 4 JavaScript Program to Check a Date is Valid or Not 5 JavaScript Program to Display Date and Time 6 JavaScript Program to Get First Day of the Year 7 JavaScript Program to Check if a Given Year is Leap Year 8 JavaScript Program to Convert Milliseconds to Date 9 JavaScript Program to Get the Current Date 10 JavaScript Program to Compare Two Dates 12 JavaScript Program to Get Tomorrow’s Date in a String Format 13 JavaScript Program to Calculate Current Week Number 14 JavaScript Program to Compare Date Part Only Without Comparing Time 15 JavaScript Program to Check the Input Date is Equal to Today’s Date or Not 16 JavaScript Program to Check One Date is Between Two Dates 17 JavaScript Program to Format Current Date in MM/DD/YYYY HH:MM:SS Format 18 JavaScript Program to Convert Seconds to Time String Format hh:mm:ss 19 JavaScript Program to Validate String Date Format 20 JavaScript Program to Convert Date to String 21 JavaScript Program to Convert CFAbsoluteTime to Date Object and Vice-Versa 22 JavaScript Program to Check for Two Timestamp for the Same Day 23 JavaScript Program to Check if the Given Date is Weekend 24 JavaScript Program to Display JavaScript Datetime in 12 Hour AM/PM Format 25 JavaScript Program to Calculate the Yesterday’s Date in JavaScript 26 JavaScript Program to Get the First and Last Date of Current Month 27 JavaScript Program to Remove Time from Date 28 JavaScript Program to Get Month and Date in Two Digit Format 29 JavaScript Program to Sort an Object Array by Date 30 JavaScript Program to Get the Relative Timestamp Difference Between Dates 31 JavaScript Program to Check if Date is Less Than 1 Hour Ago 32 JavaScript Program to Calculate Days Left Until Next Christmas JavaScript Set and Map Programs This section contains wide collection of programming articles based on Set and Map objects. Set is a collection of items that are unique i.e. no element can be repeated. The map is a collection of elements where each element is stored as a Key, value pair. S. No. Articles 1 JavaScript Program to Sort a Set 2 JavaScript Program to Iterate Over Set Elements 3 JavaScript Program to Convert Set to Array 4 JavaScript Program to Convert Array to Set 5 JavaScript Program to Perform Intersection of Two Sets 6 JavaScript Program to Get the Union of Two Sets 7 JavaScript Program to Order the Elements in a Set 8 JavaScript Program to Serialize a Map 9 JavaScript Program to Iterate Over Map Elements 10 JavaScript Program to Sort a Map 11 JavaScript Program to Get Key by Value in a Map 12 JavaScript Program to Update the Value for a Specific Key in Map 13 JavaScript Program to Add a key/value Pair to Map 14 JavaScript Program to Combine Values of Two Maps having Same Key 15 JavaScript Program to Order the Elements in a Map Like Article Suggest improvement Next JavaScript Programs Share your thoughts in the comments Add Your Comment Please Login to comment...