Skip to content

Instantly share code, notes, and snippets.


Shyam Ghanshyam-K-Dobariya

Block or report user

Report or block Ghanshyam-K-Dobariya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
function isValidEmailId(emailId) {
var exp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
return exp.test(emailId)

Ever wondered why setting array.length = 0 makes an array empty or array.length = 'some string' throws exception ? Code example.

screen shot 2018-09-14 at 10 16 50 

So now you have curiosity to know what happens in the background when command array.length = 0 takes place ?

Let's start this journey with below requirement.


Create a higher order function that accepts a react component. Do logs when life cycle methods (componentWillReceiveProps or render) are called


export function hocF (Component) {
  const cwp = Component.prototype.componentWillReceiveProps;
  Component.prototype.componentWillReceiveProps = function(...args) {
    console.log('in Component will receive props....'), ...args)
You can’t perform that action at this time.