Basic Programs
String Programs
- Access character in a string using square brackets in JavaScript
- Check if string contains specific substring in JavaScript
- Check if string is empty in JavaScript
- Check if two strings are equal in JavaScript
- Compare two strings in JavaScript
- Convert first character of string to uppercase in JavaScript
- Convert CSV string to array in JavaScript
- Create string with single quotes in JavaScript
- create string with double quotes in JavaScript
- create multiline string in JavaScript
- get first character from string in JavaScript
- get last character from string in JavaScript
- get character at specific index from string in JavaScript
- include variables in a string in JavaScript
- length of a string in JavaScript
- remove first character from string in JavaScript
- remove last character from string in JavaScript
- remove character at specific index from string in JavaScript
- remove all occurrences of a specific character from a string in JavaScript
- replace all occurrences of a substring in a string in JavaScript
- replace all occurrences of a specific character from a string in JavaScript
- replace a specific character in a string in JavaScript
- slice() vs substring() in JavaScript
- split string at commas in JavaScript
- split string at new lines in JavaScript
- split string into array of characters in JavaScript
Array Programs
- append an element to array
- append an array to another array
- check if all the numbers in array are even
- check if all the numbers in array are odd
- check if all the strings in array are non-empty
- check if array is empty
- convert array into CSV string
- filter even numbers in an array
- filter odd numbers in an array
- find index of element in array
- find largest element in numeric array
- find longest string in array
- find shortest string in array
- find smallest element in numeric array
- get item at given index from array
- iterate over elements of array using for loop
- iterate over elements of array using while loop
- iterate over elements of array using for…in loop
- remove first item from array
- remove last item from array
- remove specific item from an array
- reverse an array of strings
- sort array of strings lexicographically
- sort array of strings based on string length
- sort array of numbers in ascending order
- sort array of numbers in descending order
Set Programs
- create an empty set
- convert an array into a set
- convert set into an array
- print elements of set as a string
Numeric Programs
- add two numbers
- average of numbers in array
- average of two numbers
- check if a number is Armstrong number
- check if a number is even or odd
- check if a number is factor of another number
- check if a number is positive
- check if a number is negative
- check if a number is zero
- compare two numbers
- factorial using for loop
- factorial using recursion
- find largest of three numbers
- find square root
- find smallest of three numbers
- generate random number
- reverse a number
- sum of first n natural numbers
- sum of squares of first n natural numbers
- swap two variables