Skip to content

Instantly share code, notes, and snippets.

def print_tables():
for x in range(1, 13):
for y in range(1, 13):
z = x * y
print(z, end="\t")
print() #creates the space after the loop
def main():
print_tables()
import React, { Suspense, useState, useEffect } from 'react'; // React should also be imported
const SuspensefulUserProfile = ({ userId } :{ userId: number }) => { //since this file extension is .tsx then type should assign else this will throw error
const [data, setData] = useState({});
useEffect(() => {
fetchUserProfile(userId).then((profile) => setData(profile));
}, [userId]) // we should not add setData as a dependency here, userId is enough
return (
<Suspense fallback={<Loading /> || null}> //fallback should always be here
<UserProfile data={data} />
@priyankaa02
priyankaa02 / test.js
Created January 26, 2019 09:20
finding age between 30 and 40
function peopleArray(listOfPeople){
let filteredArray = []
for ( var i = 0; i < listOfPeople.length; i++){
if(listOfPeople[i].age > 30 && listOfPeople[i].age < 40){
filteredArray.push(listOfPeople[i])
}
}
return filteredArray
}