• Mar 11, 2021 •C S
0 likes • 2 views
import { configureStore } from "@reduxjs/toolkit"; import { combineReducers } from "redux"; import profile from "./profile"; import auth from "./auth"; import alert from "./alert"; const reducer = combineReducers({ profile, auth, alert, }); const store = configureStore({ reducer }); export default store;
• Nov 19, 2022 •CodeCatch
0 likes • 3 views
const linearSearch = (arr, item) => { for (const i in arr) { if (arr[i] === item) return +i; } return -1; }; linearSearch([2, 9, 9], 9); // 1 linearSearch([2, 9, 9], 7); // -1
• Oct 15, 2022 •CodeCatch
2 likes • 9 views
var invertTree = function(root) { const reverseNode = node => { if (node == null) { return null } reverseNode(node.left); reverseNode(node.right); let holdLeft = node.left; node.left = node.right; node.right = holdLeft; return node; } return reverseNode(root); };
0 likes • 0 views
const union = (...arr) => [...new Set(arr.flat())]; // Example union([1, 2], [2, 3], [3]); // [1, 2, 3]
• Nov 20, 2022 •Helper
new StringBuilder(hi).reverse().toString()
1 like • 280 views
const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(port, () => { console.log(`Example app listening on port ${port}`) })