express model enum type
drink: { type: String, enum: [‘Coffee’, ‘Tea’, ‘Water’,] }
drink: { type: String, enum: [‘Coffee’, ‘Tea’, ‘Water’,] }
const storage= [ { id:1, name:“kahnu”, email:“[email protected]”, age:21, phone:1234567890 }, { id:2, name:“kahnu2”, email:“[email protected]”, age:22, phone:1234567890 }, { id:3, name:“kahnu3”, email:“[email protected]”, age:23, phone:1234567890 } ] const objIndex = storageData.findIndex((obj => obj.id == ‘1’)); storageData[objIndex].name = ‘new name’; storageData[objIndex].email = ‘new email’; storageData[objIndex].age = ‘new age’; console.log(“After update: “, storageData[objIndex])
function copyToClipboard(elementId) { var copyTextarea = document.getElementById(elementId); console.log(copyTextarea); copyTextarea.select(); document.execCommand(“copy”); jQuery(“.copy”).html(“Copied”); if (jQuery(‘.tcopy’).length) { jQuery(‘#’ + elementId.slice(1)).html(“Copied”); } jQuery(“#liveToast”).toast(“show”); }
function getDateTime(MatchTimeStamp){ var date = new Date(MatchTimeStamp); var Hours = date.getHours() >12 ? date.getHours()-12 : date.getHours(); var ampm = date.getHours() >= 12 ? ‘pm’ : ‘am’; var fullDate = `${date.getDate()}–${date.getMonth()+1}–${ date.getFullYear()}`; var fullTime = `${Hours}:${date.getMinutes()} ${ampm}`; return {‘date’: fullDate , ‘time’ : fullTime} }
Using different key for each route should force components to rebuild: import React, { Component } from ‘react’;import Navbar from ‘./Components/Navbar’;import News from ‘./Components/News’;import Test from ‘./Components/Test’;import NoMatch from ‘./Components/NoMatch’;import { BrowserRouter , Route, Routes } from ‘react-router-dom’export default class App extends Component { render() { return <div> <BrowserRouter> < Navbar /> <Routes> <Route path=”/” element={<News pageSize={8} …
using same component for different route path in react-router v6 Read More »