Skip to content

Instantly share code, notes, and snippets.

View iamsaief's full-sized avatar
🚀
Gotta debug before I sleep ⏳

Saief Al Emon iamsaief

🚀
Gotta debug before I sleep ⏳
View GitHub Profile
import React, { useState, useEffect } from "react";
function App() {
return (
<div>
<Users />
</div>
);
}
import React, { useState } from "react";
function App() {
return (
<div>
<Counter />
</div>
);
}
function App() {
const products = [
{ name: "Photoshop", price: "$4.00" },
{ name: "Figma", price: "$5.00" },
{ name: "Sketch", price: "$6.00" },
{ name: "After Efects", price: "$26.00" },
{ name: "Premier pro", price: "$96.00" },
];
return (
function App() {
const products = [
{ name: "Photoshop", price: "$4.00" },
{ name: "Figma", price: "$5.00" },
{ name: "Sketch", price: "$6.00" },
];
return (
<div>
<Products
function App() {
return (
<div>
<HelloWorld name='Hello World'></HelloWorld>
<HelloWorld name='Hello Bangladesh'></HelloWorld>
</div>
);
}
function HelloWorld(props) {
return (
function HelloWorld() {
return (
<div>
<h3>Hello World!</h3>
</div>
);
}
/* inheritance, extends, super */
class Parent {
constructor() {
this.fatherName = "Christopher Nolan";
this.motherName = "Emma Thomas";
}
}
class Child extends Parent {
constructor(name, age) {
super();
/* class, constructor, object */
class Student {
constructor(name, id) {
this.name = name;
this.id = id;
this.university = "Harvard University";
}
}
const student1 = new Student("Tom Hardy", 101);
/* Arrow functions - implicit return*/
const doubleIt = (num) => num * 2;
console.log(doubleIt(4));
// Output: 8
const add = (a, b) => a + b;
console.log(add(40, 50));
// Output: 90
/* explicit return */
/* Default Parameter */
function addFifty(num1, num2 = 50) {
return num1 + num2;
}
const result = addFifty(10, 20);
const result2 = addFifty(20);
console.log(result, result2);
// Output : 30 70
/* Template string */