Interview Questions

Javascript security vulnerabilities checklist

Tools to check javascript security vulnerabilities 1) npm installIf you are using npm install in your application, make sure you keep all packages updated to the latest versions. 2) Snyk toolYou can signup for Synk tool for free and add repo to check issues.Synk can be integrated with Github repository and it can create pull …

Javascript security vulnerabilities checklist Read More »

Google Geocoding API to display address details

Google Geocoding API to display address details including latitude and longitude Create your own Google API key and update YOUR_API_KEY in the src/script.js https://developers.google.com/maps/documentation/javascript/get-api-key Use HTML, Javascript and CSS Include axios CDN or you can use npm install Inlude bootstrap CDN or use npm install Address search results using Google Geocodig API Step 1 – create an …

Google Geocoding API to display address details Read More »

Display google maps with different marker icons

Google Maps API to display map with different types of markers for multiple locations First you will need to get Google Maps API key from below link: https://developers.google.com/maps/documentation/javascript/get-api-key Update this API key at YOUR_API_KEY in index.html Step 1 – create an index.html which is used to display map in the div section where id is …

Display google maps with different marker icons Read More »

Create a TODO list design using javascript, html, css

This is a simple todo application design using html, css and vanilla javascript. You will need an editor of your choice to begin with. I usually use vscode with Liveserver extension which helps to view developed application in the browser. First step is to create an html page which will display the todo list. Create …

Create a TODO list design using javascript, html, css Read More »

What is WebKit? How is it used by browsers and CSS?

WebKit is a HTML web browser rendering engine which is used by Safari and Chrome browsers.It supports custom css properties which can be prefixed with -webkit- For example -webkit-font-size will be replaced by the standard font-size. Below is the list of various other browsers and rendering engines, css-prefix used by them: Browser Engine CSS Prefix …

What is WebKit? How is it used by browsers and CSS? Read More »

Validate a palindrome

A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam or racecar.  Return True if it”s a palindrome and False if not palindrome

Design Patterns in PHP – Chain-of-responsibility pattern

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 »

Design Patterns in PHP – Observer pattern

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 »

Design Patterns in PHP – Strategy pattern

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 »

Design Patterns in PHP – Decorator design pattern

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 »

Find the symmetric difference between arrays using javascript

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 »

Measure execution time of a function using javascript

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 »