Skip to content

Instantly share code, notes, and snippets.

View mimnets's full-sized avatar

Monirul Islam mimnets

View GitHub Profile
@mimnets
mimnets / swap
Last active July 16, 2020 03:39
Do you know how to swap two variable data? I know you did try it many times! Wait how I know? Because you are I, and I am you!!!
var abul = 100;
var babul = 99;
console.log("Before swap abul = ", abul, "babul = ", babul);
var temp = abul; //The temp value is now abul's value 100.
abul = babul // now abul has babul's value 99.
babul = temp //because temp has babul's value 100.
console.log("After swap abul = ", abul, "babul = ",babul);
@mimnets
mimnets / fdeclare.js
Last active November 3, 2020 16:33
function with default values
function test () {
const a = 5;
const b = 5;
return a + b;
}
function test (a, b) {
return a + b;
}
function test (a, b = 1) {
return a + b;
}
import React from 'react';
// Correct! This is a component and should be capitalized:
function Hello(props) {
// Correct! This use of <div> is legitimate because div is a valid HTML tag:
return <div>Hello {props.toWhat}</div>;
}
function HelloWorld() {
// Correct! React knows <Hello /> is a component because it's capitalized.