What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-05 06:13:11
javascript list object properties
var person={"first_name":"Bill","last_name":"Jenner"} //get the person object properties with: var keys = Object.keys(person); //keys = ["first_name","last_name"] Add solution -
Javascript 2021-11-05 00:37:16
socket emit to specific room using nodejs socket.io
// sending to sender-client only socket.emit('message', "this is a test"); // sending to all clients, include sender io.emit('message', "this is a test"); // sending to all clients except sender socket.broadcast.emit('message', "... Add solution -
-
Javascript 2021-11-03 20:53:07
js convert array to object
var obj = {"1":5,"2":7,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0} var result = Object.keys(obj).map(function(key) ... Add solution -
Javascript 2021-11-03 15:28:14
get data from fetch api into variable
<script> function getFromAPI(url, callback){ var obj; fetch(url) .then(res => res.json()) .then(data => obj = data) .then(() => callback(obj)) } getFromAPI('https://jsonplaceholder.typicode.com/posts', getData); function ... Add solution