Skip to content

Instantly share code, notes, and snippets.

Avatar
👓

ShilpiMaurya

👓
View GitHub Profile
View redirect.md

Redirects

What is a redirect?

  • A url redirect is a process that navigates a user from one url to another
  • Sometimes we need to redirect a user to a different page in our website without them clicking on a link

Types of redirecting :

Redirecting through history api (Client-side redirect)

  • We can use javascript to navigate through the history
View ideas.md
View overlapingRectangle.js
//Write a program to find out if two rectangles R1 and R2 are overlapping?
const overlappingRectangle = (
R1x1,
R1x2,
R1y1,
R1y2,
R2x1,
R2x2,
R2y1,
View description.md

Dear product-owner/scrum-master

I would like to pitch few ideas and suggestions for the home page of the website.

  • I was thinking of splitting home page into two parts.

  • Part one would be like this, more of a welcome page, with your full size picture in it, so that people could feel instantly connected, nice and warm. People should feel like they know the person they are seeking advice from. (from empathy point of view)

    http://www.garysheng.com/

Screen Shot 2020-12-17 at 12 53 35

View maxOccuringChar.js
//How to find the maximum occurring character in given String?
const maxOccuringChar = str => {
if (typeof str !== "string" || !str.length) {
return null;
}
const count = {};
let max = 0;
let maxChar = null;
View inheritance.js
//Inheritance example in js
class Rectangle {
constructor(length, width) {
this.length = length;
this.width = width;
}
Area() {
return this.length * this.width;
View oneDuplicateNum.js
//In an array 1-100 exactly one number is duplicate how do you find it?
const findOneDuplicateNum = arr => {
if (!Array.isArray(arr) || !arr.length) {
return null;
}
let count = {};
for (let i = 0; i < arr.length; i++) {
View longestSubstring.js
// How do you find the length of the longest substring without repeating
//characters?
const longestSubstring = str => {
if (typeof str !== "string" || !str.length) {
return null;
}
const letters = str
.toLowerCase()
View secondLargestNum.js
//How do you find the second highest number in an integer array?
const secondHighestNumber = arr => {
if (!Array.isArray(arr) || !arr.length) {
return null;
}
let largestNum = Math.max(...arr);
arr.splice(arr.indexOf(largestNum), 1);
let secondHighestNum = Math.max(...arr);