Skip to content

Instantly share code, notes, and snippets.

View rubnvp's full-sized avatar
🛵
:D

Rubén Valseca rubnvp

🛵
:D
View GitHub Profile
@rubnvp
rubnvp / spread-operator.js
Created November 12, 2020 11:11
JavaScript spread operator to conditionally add keys to objects or elements to arrays
const user = {
name: 'John',
...isAdmin && {adminGroup: 'super-admin'},
};
const options = [
'fruits',
...hasFlowers ? ['flowers'] : [],
];
[
{
"login": "AilatanGH",
"id": 26969648,
"avatar_url": "https://avatars2.githubusercontent.com/u/26969648?v=4",
"html_url": "https://github.com/AilatanGH"
},
{
"login": "Alienah",
"id": 33132944,
@rubnvp
rubnvp / test.js
Created July 29, 2019 15:22
Gist test
(function(){
window.sayHi = () => console.log('Hi there! :D');
})();