What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-17 04:25:23
express basic routing syntax
var express = require('express') var router = express.Router() // middleware that is specific to this router router.use(function timeLog (req, res, next) { console.log('Time: ', Date.now()) next() }) // define the home page route router.get('/', func... Add solution -
Javascript 2022-03-17 03:55:01
javascript terminal base64 encoder
// Copy the following code into a file.js to parse values from terminal function getBase64(base64) { return Buffer.from(base64).toString('base64'); } console.log(getBase64(process.argv[2])); // In terminal write the following granted nodejs is inst... Add solution -
Javascript 2022-03-17 02:45:19
javascript create matrix
// this will create a 2D array of 'none' word var size = 3; var myArray = Array(size).fill( Array(size).fill("none") ); console.log(myArray); /* [ ["none", "none", "none"], ["none", "none", &q... Add solution -
Javascript 2022-03-17 01:45:19
for array javascript
let array = ['Item 1', 'Item 2', 'Item 3']; // Here's 4 different ways for (let index = 0; index < array.length; index++) { console.log(array[index]); } for (let index in array) { console.log(array[index]); } for (let value of array) { console... Add solution -
TypeScript 2022-03-16 23:35:15
transform snake case in camel case typescript
const toCamelCase = (str: string): string =>{ let charsLowerCase = str.toLowerCase().split(''); let camelCaseKey = ''; for (let pos = 0; pos < charsLowerCase.length; pos++) { if (charsLowerCase[pos] === '_') { ... Add solution -
Other 2022-03-16 22:45:14
solo leveling ss2
console.log('When Solo Leveling End?, Day 1, 5/4/2021') Add solution -
Javascript 2022-03-16 22:30:12
javascript loop through arrya
var data = [1, 2, 3, 4, 5, 6]; // traditional for loop for(let i=0; i<=data.length; i++) { console.log(data[i]) // 1 2 3 4 5 6 } // using for...of for(let i of data) { console.log(i) // 1 2 3 4 5 6 } // using for...in for(let i in data) { con... Add solution -
Other 2022-03-16 22:00:14
setState of one element of an object of states
function LoginForm() { const [form, setState] = useState({ username: '', password: '' }); const printValues = e => { e.preventDefault(); console.log(form.username, form.password); }; const updateField = e => { setStat... Add solution