JSFiddle - React, Tailwind, and code Playground
by saidulu401
JavaScript
/* 1. Create a reusable card-like component that displays the Products
2. GET data from this https://fakestoreapi.com/products API when the component loads, each product should be displayed in a Card
3. CSS Flex / Grid should be used to display the layout */
/* function promise(){
return new Promise((resolve,reject)=>{
setTimeout(()=>{
resolve('returned form promise')
},5000)
})
}
async function p(){
return await promise();
}
promise().then(()=>{
console.log(p())
}).catch
console.log('outside') */
function sum(){
let total = 0;
/* const sumInternal = (...arg)=>{
if(arg.length===0){
//return total;
}else {
total += arg.reduce((a,b)=>a+b,0)
sumInternal(arg)
}
} */
return total;
}
console.log(sum(2,4,2,3)(3,5,6,8)(4,6,7,8)(5,8,7,6)())
/* state
reducer
effect
actions
selecter
key string, value array of object
{
'names':[{}]
}
interface Obj{
name:string;
}
interface User {
[key:string]:Obj[]
} */
/* const getSum = (arr)=>arr.reduce((a,b)=>a+b,0)
function sum(){
let total = 0
return (...arg1)=>{
total += getSum(arg1)
return (...arg2)=>{
total += getSum(arg2)
return (...arg3)=>{
total += getSum(arg3)
return ()=>{return total}
}
}
}
} */