Reverse a string using javascript
Reverse a string using javascript
Reverse a string using javascript Read More »
Reverse a string using javascript
Reverse a string using javascript Read More »
Left rotate array using javascript Rotate array by d digits using javascript Method 1 using shift() and push() Method 2 using ES6 Spread Operator and Slice() – one liner
Left rotate array using javascript Read More »
Flatten a multidimensional associative array using javascript
Flatten a multidimensional associative array into one-dimensional array using javascript Read More »
Chain-of-responsibility pattern The chain-of-responsibility pattern is a behavioral design pattern consisting of a source of command objects and a series of processing objects. Each processing object contains logic that defines the types of command objects that it can handle; the rest are passed to the next processing object in the chain. A mechanism also exists
Design Patterns in PHP – Chain-of-responsibility pattern Read More »
Observer pattern The observer pattern is a software design pattern in which an object, named the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. It is mainly used for implementing distributed event handling systems, in “event driven” software. In
Design Patterns in PHP – Observer pattern Read More »
Strategy pattern The strategy pattern (also known as the policy pattern) is a behavioral software design pattern that enables selecting an algorithm at runtime. Instead of implementing a single algorithm directly, code receives run-time instructions as to which in a family of algorithms to use. Strategy lets the algorithm vary independently from clients that use
Design Patterns in PHP – Strategy pattern Read More »
Template method pattern The template method is a method in a superclass, usually an abstract superclass, and defines the skeleton of an operation in terms of a number of high-level steps. These steps are themselves implemented by additional helper methods in the same class as the template method. The helper methods may be either abstract
Design Patterns in PHP – Template method pattern Read More »
Adapter design pattern The adapter pattern is a software design pattern (also known as wrapper, an alternative naming shared with the decorator pattern) that allows the interface of an existing class to be used as another interface. It is often used to make existing classes work with others without modifying their source code. An example
Design Patterns in PHP – Adapter design pattern Read More »
The Decorator Pattern, Adapter Pattern, Template Method Pattern, Strategy Pattern, Observer Pattern Decorator design pattern In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object, dynamically, without affecting the behavior of other objects from the same class. The decorator pattern is often useful for adhering
Design Patterns in PHP – Decorator design pattern Read More »
Add an array in the middle on another associative array in php
Add an array in the middle on another associative array in php Read More »
Find the symmetric difference between arrays using javascript In mathematics, the symmetric difference of two sets, also known as the disjunctive union, is the set of elements which are in either of the sets, but not in their intersection. The mathematical term symmetric difference (△ or ⊕) of two sets is the set of elements
Find the symmetric difference between arrays using javascript Read More »
What is higher order functions? A function that takes or returns another function has become “higher-order”. Higher-order functions let us abstract common actions like map, filter, and reduce. Higher-order functions can be set as object properties. They are useful if you are calling a list of functions in response to an event. The javascript Event
Javascript higher order functions Read More »
Check if first letter of sentence is capital or not
Check if first letter of sentence is capital or not using Javascript Read More »
Here we will take ROT13 encoded string as input and returns a decoded string.
Caesars Cipher using javascript arrow functions Read More »
You can measure the performance of javascript code using console.time() function. This can be helpful in debugging and optimizing code which is taking lot of memory. console.time() can be used with console.timeEnd(). console.timeEnd() function tells console to stop calculating the time. You will see result as below: Running loop :0 timesRunning loop :1 timesRunning loop
Measure execution time of a function using javascript Read More »
Count number of same characters in a string and display in the array using javascript
Count number of same characters in a string and display in the array using javascript Read More »
One-liner solution with ES6 syntax
Convert binary to english characters using javascript Read More »
You can loop through the array entries, check if it’s an array with isArray() and recursively flatten the entries of the array as below:
Flatten a nested array using javascript Read More »
What is a palindrome? Palindrome is a word or phrase which reads same if reversed. For example – if we reverse Racecar it will read the same both backward or forwards. A few examples of words that are palindrome are Noon, Racecar, Wow, Refer, etc.
Check if a string is a palindrome or not using javascript Read More »
Convert string into an url slug using javascript
Convert string into an url slug using javascript Read More »
Sort an array using javascript
Sort an array using javascript Read More »
A laravel movie search application using Vue JS, Vue Composition API and OMDBAI API. OMDBAI is used to fetch the movies data from https://www.omdbapi.com/ Requirements Installation You will need to gety API key from the OMDb API and update in /resources/js/components/movieapi/movie-api.js file Once you are done with the above steps, now its time to start building the movie
Make every first letter of a word capitalized
Make every first letter of a word capitalized in a sentence using javascript Read More »
Convert Celsius to Fahrenheit using javascript
Convert Celsius to Fahrenheit using javascript Read More »
Fizz Buzz Print the numbers from 1 to 100. Multiples of three print “Fizz” with the number and for the multiples of five print “Buzz” with the number. If number is multiples of both three and five display “FizzBuzz” and number.
Fizz Buzz Test using javascript Read More »
Create permutations for an array using javascript
How to create permutations for an array using javascript Read More »