Skip to content

Instantly share code, notes, and snippets.

View pankajladhar's full-sized avatar
🏠
Working from home

Pankaj Ladhar pankajladhar

🏠
Working from home
View GitHub Profile
@pankajladhar
pankajladhar / VowelCount.js
Created January 13, 2018 07:26
Count vowels available in string
/*
VowelCount is javascript function which takes string as input
return count of vowels available or 0 if no vowels available
*/
const VowelCount = (str) =>{
const vowelArray = ['a', 'e', 'i', 'o', 'u'];
let counter = 0;
for (let i = 0; i < vowelArray.length; i++) {
for (let j = 0; j < str.length; j++) {
@pankajladhar
pankajladhar / ReverseString.js
Created January 13, 2018 07:36
Reverse a string
/*
ReverseString(str) take the str parameter being passed and return the string in reversed order.
For example: if the input string is "Hello World and Coders"
then your program should return the string sredoC dna dlroW olleH.
*/
const ReverseString = (str) => {
let reversedString = "";
for (let i = str.length - 1 ; i >= 0; i--) {
reversedString = reversedString + str[i]
@pankajladhar
pankajladhar / ExpressionMatcher.js
Created January 13, 2018 08:08
ExpressionMatcher is take the str parameter being passed and return "Expression Matched" or "Expression Not Matched"
/*
ExpressionMatcher is take the str parameter being passed
and return "Expression Matched" or "Expression Not Matched"
@param {string} str
@param {array} openExpArr <optional>
default value ['[', '{', '(']
@param {array} closeExpArr <optional>
default value [')', '}', ']']
@returns