What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2022-03-27 17:15:20
angular formgroup mark as touched
// From Angular 8/9 you can simply use this.formGroup.markAllAsTouched(); /** * For version older than Angular 8 * Marks all controls in a form group as touched * @param formGroup - The form group to touch */ private markFormGroupTouched(formGroup:... Add solution -
Java 2022-03-24 17:40:08
java map foreach
Map<String, Integer> items = new HashMap<>(); items.put("A", 10); items.put("B", 20); items.put("C", 30); items.put("D", 40); items.put("E", 50); items.put("F", 60); items.forEach((k... Add solution -
Javascript 2022-03-22 13:20:11
creating room in ws node js
const rooms = {}; wss.on("connection", socket => { const uuid = ...; // create here a uuid for this connection const leave = room => { // not present: do nothing if(! rooms[room][uuid]) return; // if the one exiting is t... Add solution -
Other 2022-03-19 13:10:05
javascript loop an array
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 -
Javascript 2022-03-18 07:30:11
reverse keys and values in object javascript
//The concise way by using ES6 syntax like this. const obj = {A : 1, B : 2, C : 3, D : 4} function objectFlip(obj) { return Object.entries(obj).reduce((acc, [key, value]) => (acc[value] = key, acc), {}) } console.log('input: ',obj); console.lo... Add solution