├── 01-desestructuracion ├── index.html └── js │ └── main.js ├── 02-modulos ├── capitalizar.js ├── dist │ └── main.js ├── index.html ├── main.js ├── package-lock.json ├── package.json └── src │ ├── capitalizar.js │ └── index.js ├── 03-spread_rest └── spread-rest.js ├── 04-classes └── clasess.js ├── 05-promises └── promises.js ├── 06-fetch ├── fetch.js └── index.html ├── 07-async-await └── async-await.js ├── 08-mejores-objetos ├── index.html └── mejores-objetos.js ├── 09-for-of-iterables ├── index.html └── iterables-looping.js ├── 10-mejores-matrices ├── index.html ├── mejores-matrices.js └── users.js ├── 11-parametros-defecto ├── index.html └── parametros-defecto.js ├── 12-mejores-numeros ├── index.html └── mejores-numeros.js ├── 13-sets ├── sets.js └── test.js ├── 14-maps └── maps.js ├── 15-mejores-strings ├── index.html └── mejores-strings.js ├── 16-arrow-functions └── arrow-functions.js └── 17-nuevas-variables └── nuevas-variables.js /01-desestructuracion/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JS 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /01-desestructuracion/js/main.js: -------------------------------------------------------------------------------- 1 | // Desestructurando matrices 2 | const aprender = ["Vue", "JavaScript", "Laravel", "CSS"]; 3 | 4 | // var vue = aprender[0]; 5 | // var javascript = aprender[1]; 6 | // var laravel = aprender[2]; 7 | // var css = aprender[3]; 8 | 9 | var [vue, javascript, laravel, css] = aprender; 10 | 11 | // Desestructurar strings 12 | var direccion = "Calle San Almagro, 22, 3º puerta 5, 46006, Valencia"; 13 | // var [calle, numero, piso, cp, ciudad] = direccion.split(','); 14 | 15 | // Desestructurando objetos 16 | const gato = { 17 | nombre: "Guizmo", 18 | raza: "europea", 19 | color: "negro", 20 | edad: 2, 21 | hermano: { 22 | nombre: "Rouco", 23 | raza: "europea", 24 | color: "blanco y negro" 25 | }, 26 | }; 27 | 28 | // var nombre = gato.nombre; 29 | // var color = gato.color; 30 | var {nombre, edad, color} = gato; 31 | var {nombre:nombreHermano, edad:edadHermano = "desconocida", color:colorHermano} = gato.hermano; 32 | 33 | // Reemplazo de los parámetros por defecto 34 | // function saludar(saludo, nombre = "Juan", momento) { 35 | // alert(`${saludo} ${nombre}, feliz ${momento}`); 36 | // } 37 | 38 | // saludar("Hola", undefined, "tarde"); 39 | 40 | function saludar({saludo, nombre = "Juan", momento = "día"}) { 41 | alert(`${saludo} ${nombre}, feliz ${momento}`); 42 | } 43 | 44 | saludar({saludo: "Hola"}); -------------------------------------------------------------------------------- /02-modulos/capitalizar.js: -------------------------------------------------------------------------------- 1 | function capitalizar(frase) { 2 | return frase.substring(0, 1).toUpperCase() + frase.substring(1, frase.length); 3 | } 4 | 5 | export default capitalizar; -------------------------------------------------------------------------------- /02-modulos/dist/main.js: -------------------------------------------------------------------------------- 1 | !function(n){var t={};function r(e){if(t[e])return t[e].exports;var u=t[e]={i:e,l:!1,exports:{}};return n[e].call(u.exports,u,u.exports,r),u.l=!0,u.exports}r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:e})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var u in n)r.d(e,u,function(t){return n[t]}.bind(null,u));return e},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=3)}([function(n,t,r){(function(n,e){var u; 2 | /** 3 | * @license 4 | * Lodash 5 | * Copyright OpenJS Foundation and other contributors 6 | * Released under MIT license 7 | * Based on Underscore.js 1.8.3 8 | * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 9 | */(function(){var i,o=200,f="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",c="__lodash_hash_undefined__",l=500,s="__lodash_placeholder__",h=1,p=2,v=4,_=1,g=2,y=1,d=2,b=4,w=8,m=16,x=32,j=64,A=128,O=256,k=512,I=30,R="...",S=800,z=16,E=1,L=2,W=1/0,C=9007199254740991,T=17976931348623157e292,U=NaN,B=4294967295,$=B-1,P=B>>>1,D=[["ary",A],["bind",y],["bindKey",d],["curry",w],["curryRight",m],["flip",k],["partial",x],["partialRight",j],["rearg",O]],M="[object Arguments]",F="[object Array]",N="[object AsyncFunction]",q="[object Boolean]",Z="[object Date]",K="[object DOMException]",V="[object Error]",G="[object Function]",H="[object GeneratorFunction]",J="[object Map]",Y="[object Number]",Q="[object Null]",X="[object Object]",nn="[object Proxy]",tn="[object RegExp]",rn="[object Set]",en="[object String]",un="[object Symbol]",on="[object Undefined]",fn="[object WeakMap]",an="[object WeakSet]",cn="[object ArrayBuffer]",ln="[object DataView]",sn="[object Float32Array]",hn="[object Float64Array]",pn="[object Int8Array]",vn="[object Int16Array]",_n="[object Int32Array]",gn="[object Uint8Array]",yn="[object Uint8ClampedArray]",dn="[object Uint16Array]",bn="[object Uint32Array]",wn=/\b__p \+= '';/g,mn=/\b(__p \+=) '' \+/g,xn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,jn=/&(?:amp|lt|gt|quot|#39);/g,An=/[&<>"']/g,On=RegExp(jn.source),kn=RegExp(An.source),In=/<%-([\s\S]+?)%>/g,Rn=/<%([\s\S]+?)%>/g,Sn=/<%=([\s\S]+?)%>/g,zn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,En=/^\w*$/,Ln=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wn=/[\\^$.*+?()[\]{}|]/g,Cn=RegExp(Wn.source),Tn=/^\s+|\s+$/g,Un=/^\s+/,Bn=/\s+$/,$n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Pn=/\{\n\/\* \[wrapped with (.+)\] \*/,Dn=/,? & /,Mn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Fn=/\\(\\)?/g,Nn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,qn=/\w*$/,Zn=/^[-+]0x[0-9a-f]+$/i,Kn=/^0b[01]+$/i,Vn=/^\[object .+?Constructor\]$/,Gn=/^0o[0-7]+$/i,Hn=/^(?:0|[1-9]\d*)$/,Jn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yn=/($^)/,Qn=/['\n\r\u2028\u2029\\]/g,Xn="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",nt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",tt="[\\ud800-\\udfff]",rt="["+nt+"]",et="["+Xn+"]",ut="\\d+",it="[\\u2700-\\u27bf]",ot="[a-z\\xdf-\\xf6\\xf8-\\xff]",ft="[^\\ud800-\\udfff"+nt+ut+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",at="\\ud83c[\\udffb-\\udfff]",ct="[^\\ud800-\\udfff]",lt="(?:\\ud83c[\\udde6-\\uddff]){2}",st="[\\ud800-\\udbff][\\udc00-\\udfff]",ht="[A-Z\\xc0-\\xd6\\xd8-\\xde]",pt="(?:"+ot+"|"+ft+")",vt="(?:"+ht+"|"+ft+")",_t="(?:"+et+"|"+at+")"+"?",gt="[\\ufe0e\\ufe0f]?"+_t+("(?:\\u200d(?:"+[ct,lt,st].join("|")+")[\\ufe0e\\ufe0f]?"+_t+")*"),yt="(?:"+[it,lt,st].join("|")+")"+gt,dt="(?:"+[ct+et+"?",et,lt,st,tt].join("|")+")",bt=RegExp("['’]","g"),wt=RegExp(et,"g"),mt=RegExp(at+"(?="+at+")|"+dt+gt,"g"),xt=RegExp([ht+"?"+ot+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[rt,ht,"$"].join("|")+")",vt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[rt,ht+pt,"$"].join("|")+")",ht+"?"+pt+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ht+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ut,yt].join("|"),"g"),jt=RegExp("[\\u200d\\ud800-\\udfff"+Xn+"\\ufe0e\\ufe0f]"),At=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ot=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],kt=-1,It={};It[sn]=It[hn]=It[pn]=It[vn]=It[_n]=It[gn]=It[yn]=It[dn]=It[bn]=!0,It[M]=It[F]=It[cn]=It[q]=It[ln]=It[Z]=It[V]=It[G]=It[J]=It[Y]=It[X]=It[tn]=It[rn]=It[en]=It[fn]=!1;var Rt={};Rt[M]=Rt[F]=Rt[cn]=Rt[ln]=Rt[q]=Rt[Z]=Rt[sn]=Rt[hn]=Rt[pn]=Rt[vn]=Rt[_n]=Rt[J]=Rt[Y]=Rt[X]=Rt[tn]=Rt[rn]=Rt[en]=Rt[un]=Rt[gn]=Rt[yn]=Rt[dn]=Rt[bn]=!0,Rt[V]=Rt[G]=Rt[fn]=!1;var St={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zt=parseFloat,Et=parseInt,Lt="object"==typeof n&&n&&n.Object===Object&&n,Wt="object"==typeof self&&self&&self.Object===Object&&self,Ct=Lt||Wt||Function("return this")(),Tt=t&&!t.nodeType&&t,Ut=Tt&&"object"==typeof e&&e&&!e.nodeType&&e,Bt=Ut&&Ut.exports===Tt,$t=Bt&&Lt.process,Pt=function(){try{var n=Ut&&Ut.require&&Ut.require("util").types;return n||$t&&$t.binding&&$t.binding("util")}catch(n){}}(),Dt=Pt&&Pt.isArrayBuffer,Mt=Pt&&Pt.isDate,Ft=Pt&&Pt.isMap,Nt=Pt&&Pt.isRegExp,qt=Pt&&Pt.isSet,Zt=Pt&&Pt.isTypedArray;function Kt(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function Vt(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u-1}function Xt(n,t,r){for(var e=-1,u=null==n?0:n.length;++e-1;);return r}function mr(n,t){for(var r=n.length;r--&&ar(t,n[r],0)>-1;);return r}var xr=pr({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),jr=pr({"&":"&","<":"<",">":">",'"':""","'":"'"});function Ar(n){return"\\"+St[n]}function Or(n){return jt.test(n)}function kr(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function Ir(n,t){return function(r){return n(t(r))}}function Rr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r",""":'"',"'":"'"});var Cr=function n(t){var r,e=(t=null==t?Ct:Cr.defaults(Ct.Object(),t,Cr.pick(Ct,Ot))).Array,u=t.Date,Xn=t.Error,nt=t.Function,tt=t.Math,rt=t.Object,et=t.RegExp,ut=t.String,it=t.TypeError,ot=e.prototype,ft=nt.prototype,at=rt.prototype,ct=t["__core-js_shared__"],lt=ft.toString,st=at.hasOwnProperty,ht=0,pt=(r=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",vt=at.toString,_t=lt.call(rt),gt=Ct._,yt=et("^"+lt.call(st).replace(Wn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),dt=Bt?t.Buffer:i,mt=t.Symbol,jt=t.Uint8Array,St=dt?dt.allocUnsafe:i,Lt=Ir(rt.getPrototypeOf,rt),Wt=rt.create,Tt=at.propertyIsEnumerable,Ut=ot.splice,$t=mt?mt.isConcatSpreadable:i,Pt=mt?mt.iterator:i,ir=mt?mt.toStringTag:i,pr=function(){try{var n=$i(rt,"defineProperty");return n({},"",{}),n}catch(n){}}(),Tr=t.clearTimeout!==Ct.clearTimeout&&t.clearTimeout,Ur=u&&u.now!==Ct.Date.now&&u.now,Br=t.setTimeout!==Ct.setTimeout&&t.setTimeout,$r=tt.ceil,Pr=tt.floor,Dr=rt.getOwnPropertySymbols,Mr=dt?dt.isBuffer:i,Fr=t.isFinite,Nr=ot.join,qr=Ir(rt.keys,rt),Zr=tt.max,Kr=tt.min,Vr=u.now,Gr=t.parseInt,Hr=tt.random,Jr=ot.reverse,Yr=$i(t,"DataView"),Qr=$i(t,"Map"),Xr=$i(t,"Promise"),ne=$i(t,"Set"),te=$i(t,"WeakMap"),re=$i(rt,"create"),ee=te&&new te,ue={},ie=lo(Yr),oe=lo(Qr),fe=lo(Xr),ae=lo(ne),ce=lo(te),le=mt?mt.prototype:i,se=le?le.valueOf:i,he=le?le.toString:i;function pe(n){if(Sf(n)&&!df(n)&&!(n instanceof ye)){if(n instanceof ge)return n;if(st.call(n,"__wrapped__"))return so(n)}return new ge(n)}var ve=function(){function n(){}return function(t){if(!Rf(t))return{};if(Wt)return Wt(t);n.prototype=t;var r=new n;return n.prototype=i,r}}();function _e(){}function ge(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function ye(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=B,this.__views__=[]}function de(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function Te(n,t,r,e,u,o){var f,a=t&h,c=t&p,l=t&v;if(r&&(f=u?r(n,e,u,o):r(n)),f!==i)return f;if(!Rf(n))return n;var s=df(n);if(s){if(f=function(n){var t=n.length,r=new n.constructor(t);t&&"string"==typeof n[0]&&st.call(n,"index")&&(r.index=n.index,r.input=n.input);return r}(n),!a)return ri(n,f)}else{var _=Mi(n),g=_==G||_==H;if(xf(n))return Ju(n,a);if(_==X||_==M||g&&!u){if(f=c||g?{}:Ni(n),!a)return c?function(n,t){return ei(n,Di(n),t)}(n,function(n,t){return n&&ei(t,oa(t),n)}(f,n)):function(n,t){return ei(n,Pi(n),t)}(n,Ee(f,n))}else{if(!Rt[_])return u?n:{};f=function(n,t,r){var e=n.constructor;switch(t){case cn:return Yu(n);case q:case Z:return new e(+n);case ln:return function(n,t){var r=t?Yu(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}(n,r);case sn:case hn:case pn:case vn:case _n:case gn:case yn:case dn:case bn:return Qu(n,r);case J:return new e;case Y:case en:return new e(n);case tn:return function(n){var t=new n.constructor(n.source,qn.exec(n));return t.lastIndex=n.lastIndex,t}(n);case rn:return new e;case un:return u=n,se?rt(se.call(u)):{}}var u}(n,_,a)}}o||(o=new xe);var y=o.get(n);if(y)return y;o.set(n,f),Cf(n)?n.forEach(function(e){f.add(Te(e,t,r,e,n,o))}):zf(n)&&n.forEach(function(e,u){f.set(u,Te(e,t,r,u,n,o))});var d=s?i:(l?c?Ei:zi:c?oa:ia)(n);return Gt(d||n,function(e,u){d&&(e=n[u=e]),Re(f,u,Te(e,t,r,u,n,o))}),f}function Ue(n,t,r){var e=r.length;if(null==n)return!e;for(n=rt(n);e--;){var u=r[e],o=t[u],f=n[u];if(f===i&&!(u in n)||!o(f))return!1}return!0}function Be(n,t,r){if("function"!=typeof n)throw new it(a);return eo(function(){n.apply(i,r)},t)}function $e(n,t,r,e){var u=-1,i=Qt,f=!0,a=n.length,c=[],l=t.length;if(!a)return c;r&&(t=nr(t,yr(r))),e?(i=Xt,f=!1):t.length>=o&&(i=br,f=!1,t=new me(t));n:for(;++u-1},be.prototype.set=function(n,t){var r=this.__data__,e=Se(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this},we.prototype.clear=function(){this.size=0,this.__data__={hash:new de,map:new(Qr||be),string:new de}},we.prototype.delete=function(n){var t=Ui(this,n).delete(n);return this.size-=t?1:0,t},we.prototype.get=function(n){return Ui(this,n).get(n)},we.prototype.has=function(n){return Ui(this,n).has(n)},we.prototype.set=function(n,t){var r=Ui(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},me.prototype.add=me.prototype.push=function(n){return this.__data__.set(n,c),this},me.prototype.has=function(n){return this.__data__.has(n)},xe.prototype.clear=function(){this.__data__=new be,this.size=0},xe.prototype.delete=function(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r},xe.prototype.get=function(n){return this.__data__.get(n)},xe.prototype.has=function(n){return this.__data__.has(n)},xe.prototype.set=function(n,t){var r=this.__data__;if(r instanceof be){var e=r.__data__;if(!Qr||e.length0&&r(f)?t>1?qe(f,t-1,r,e,u):tr(u,f):e||(u[u.length]=f)}return u}var Ze=fi(),Ke=fi(!0);function Ve(n,t){return n&&Ze(n,t,ia)}function Ge(n,t){return n&&Ke(n,t,ia)}function He(n,t){return Yt(t,function(t){return Of(n[t])})}function Je(n,t){for(var r=0,e=(t=Ku(t,n)).length;null!=n&&rt}function nu(n,t){return null!=n&&st.call(n,t)}function tu(n,t){return null!=n&&t in rt(n)}function ru(n,t,r){for(var u=r?Xt:Qt,o=n[0].length,f=n.length,a=f,c=e(f),l=1/0,s=[];a--;){var h=n[a];a&&t&&(h=nr(h,yr(t))),l=Kr(h.length,l),c[a]=!r&&(t||o>=120&&h.length>=120)?new me(a&&h):i}h=n[0];var p=-1,v=c[0];n:for(;++p=f)return a;var c=r[e];return a*("desc"==c?-1:1)}}return n.index-t.index}(n,t,r)})}function du(n,t,r){for(var e=-1,u=t.length,i={};++e-1;)f!==n&&Ut.call(f,a,1),Ut.call(n,a,1);return n}function wu(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Zi(u)?Ut.call(n,u,1):$u(n,u)}}return n}function mu(n,t){return n+Pr(Hr()*(t-n+1))}function xu(n,t){var r="";if(!n||t<1||t>C)return r;do{t%2&&(r+=n),(t=Pr(t/2))&&(n+=n)}while(t);return r}function ju(n,t){return uo(Xi(n,t,Ea),n+"")}function Au(n){return Ae(va(n))}function Ou(n,t){var r=va(n);return fo(r,Ce(t,0,r.length))}function ku(n,t,r,e){if(!Rf(n))return n;for(var u=-1,o=(t=Ku(t,n)).length,f=o-1,a=n;null!=a&&++ui?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=e(i);++u>>1,o=n[i];null!==o&&!Uf(o)&&(r?o<=t:o=o){var l=t?null:xi(n);if(l)return Sr(l);f=!1,u=br,c=new me}else c=t?[]:a;n:for(;++e=e?n:zu(n,t,r)}var Hu=Tr||function(n){return Ct.clearTimeout(n)};function Ju(n,t){if(t)return n.slice();var r=n.length,e=St?St(r):new n.constructor(r);return n.copy(e),e}function Yu(n){var t=new n.constructor(n.byteLength);return new jt(t).set(new jt(n)),t}function Qu(n,t){var r=t?Yu(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}function Xu(n,t){if(n!==t){var r=n!==i,e=null===n,u=n==n,o=Uf(n),f=t!==i,a=null===t,c=t==t,l=Uf(t);if(!a&&!l&&!o&&n>t||o&&f&&c&&!a&&!l||e&&f&&c||!r&&c||!u)return 1;if(!e&&!o&&!l&&n1?r[u-1]:i,f=u>2?r[2]:i;for(o=n.length>3&&"function"==typeof o?(u--,o):i,f&&Ki(r[0],r[1],f)&&(o=u<3?i:o,u=1),t=rt(t);++e-1?u[o?t[f]:f]:i}}function hi(n){return Si(function(t){var r=t.length,e=r,u=ge.prototype.thru;for(n&&t.reverse();e--;){var o=t[e];if("function"!=typeof o)throw new it(a);if(u&&!f&&"wrapper"==Wi(o))var f=new ge([],!0)}for(e=f?e:r;++e1&&w.reverse(),h&&la))return!1;var l=o.get(n);if(l&&o.get(t))return l==t;var s=-1,h=!0,p=r&g?new me:i;for(o.set(n,t),o.set(t,n);++s-1&&n%1==0&&n1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace($n,"{\n/* [wrapped with "+t+"] */\n")}(e,function(n,t){return Gt(D,function(r){var e="_."+r[0];t&r[1]&&!Qt(n,e)&&n.push(e)}),n.sort()}(function(n){var t=n.match(Pn);return t?t[1].split(Dn):[]}(e),r)))}function oo(n){var t=0,r=0;return function(){var e=Vr(),u=z-(e-r);if(r=e,u>0){if(++t>=S)return arguments[0]}else t=0;return n.apply(i,arguments)}}function fo(n,t){var r=-1,e=n.length,u=e-1;for(t=t===i?e:t;++r1?n[t-1]:i;return r="function"==typeof r?(n.pop(),r):i,Lo(n,r)});function Po(n){var t=pe(n);return t.__chain__=!0,t}function Do(n,t){return t(n)}var Mo=Si(function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return We(t,n)};return!(t>1||this.__actions__.length)&&e instanceof ye&&Zi(r)?((e=e.slice(r,+r+(t?1:0))).__actions__.push({func:Do,args:[u],thisArg:i}),new ge(e,this.__chain__).thru(function(n){return t&&!n.length&&n.push(i),n})):this.thru(u)});var Fo=ui(function(n,t,r){st.call(n,r)?++n[r]:Le(n,r,1)});var No=si(_o),qo=si(go);function Zo(n,t){return(df(n)?Gt:Pe)(n,Ti(t,3))}function Ko(n,t){return(df(n)?Ht:De)(n,Ti(t,3))}var Vo=ui(function(n,t,r){st.call(n,r)?n[r].push(t):Le(n,r,[t])});var Go=ju(function(n,t,r){var u=-1,i="function"==typeof t,o=wf(n)?e(n.length):[];return Pe(n,function(n){o[++u]=i?Kt(t,n,r):eu(n,t,r)}),o}),Ho=ui(function(n,t,r){Le(n,r,t)});function Jo(n,t){return(df(n)?nr:hu)(n,Ti(t,3))}var Yo=ui(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]});var Qo=ju(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Ki(n,t[0],t[1])?t=[]:r>2&&Ki(t[0],t[1],t[2])&&(t=[t[0]]),yu(n,qe(t,1),[])}),Xo=Ur||function(){return Ct.Date.now()};function nf(n,t,r){return t=r?i:t,t=n&&null==t?n.length:t,Ai(n,A,i,i,i,i,t)}function tf(n,t){var r;if("function"!=typeof t)throw new it(a);return n=Ff(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=i),r}}var rf=ju(function(n,t,r){var e=y;if(r.length){var u=Rr(r,Ci(rf));e|=x}return Ai(n,e,t,r,u)}),ef=ju(function(n,t,r){var e=y|d;if(r.length){var u=Rr(r,Ci(ef));e|=x}return Ai(t,e,n,r,u)});function uf(n,t,r){var e,u,o,f,c,l,s=0,h=!1,p=!1,v=!0;if("function"!=typeof n)throw new it(a);function _(t){var r=e,o=u;return e=u=i,s=t,f=n.apply(o,r)}function g(n){var r=n-l;return l===i||r>=t||r<0||p&&n-s>=o}function y(){var n=Xo();if(g(n))return d(n);c=eo(y,function(n){var r=t-(n-l);return p?Kr(r,o-(n-s)):r}(n))}function d(n){return c=i,v&&e?_(n):(e=u=i,f)}function b(){var n=Xo(),r=g(n);if(e=arguments,u=this,l=n,r){if(c===i)return function(n){return s=n,c=eo(y,t),h?_(n):f}(l);if(p)return Hu(c),c=eo(y,t),_(l)}return c===i&&(c=eo(y,t)),f}return t=qf(t)||0,Rf(r)&&(h=!!r.leading,o=(p="maxWait"in r)?Zr(qf(r.maxWait)||0,t):o,v="trailing"in r?!!r.trailing:v),b.cancel=function(){c!==i&&Hu(c),s=0,e=l=u=c=i},b.flush=function(){return c===i?f:d(Xo())},b}var of=ju(function(n,t){return Be(n,1,t)}),ff=ju(function(n,t,r){return Be(n,qf(t)||0,r)});function af(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new it(a);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(af.Cache||we),r}function cf(n){if("function"!=typeof n)throw new it(a);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}af.Cache=we;var lf=Vu(function(n,t){var r=(t=1==t.length&&df(t[0])?nr(t[0],yr(Ti())):nr(qe(t,1),yr(Ti()))).length;return ju(function(e){for(var u=-1,i=Kr(e.length,r);++u=t}),yf=uu(function(){return arguments}())?uu:function(n){return Sf(n)&&st.call(n,"callee")&&!Tt.call(n,"callee")},df=e.isArray,bf=Dt?yr(Dt):function(n){return Sf(n)&&Qe(n)==cn};function wf(n){return null!=n&&If(n.length)&&!Of(n)}function mf(n){return Sf(n)&&wf(n)}var xf=Mr||qa,jf=Mt?yr(Mt):function(n){return Sf(n)&&Qe(n)==Z};function Af(n){if(!Sf(n))return!1;var t=Qe(n);return t==V||t==K||"string"==typeof n.message&&"string"==typeof n.name&&!Lf(n)}function Of(n){if(!Rf(n))return!1;var t=Qe(n);return t==G||t==H||t==N||t==nn}function kf(n){return"number"==typeof n&&n==Ff(n)}function If(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=C}function Rf(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function Sf(n){return null!=n&&"object"==typeof n}var zf=Ft?yr(Ft):function(n){return Sf(n)&&Mi(n)==J};function Ef(n){return"number"==typeof n||Sf(n)&&Qe(n)==Y}function Lf(n){if(!Sf(n)||Qe(n)!=X)return!1;var t=Lt(n);if(null===t)return!0;var r=st.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&<.call(r)==_t}var Wf=Nt?yr(Nt):function(n){return Sf(n)&&Qe(n)==tn};var Cf=qt?yr(qt):function(n){return Sf(n)&&Mi(n)==rn};function Tf(n){return"string"==typeof n||!df(n)&&Sf(n)&&Qe(n)==en}function Uf(n){return"symbol"==typeof n||Sf(n)&&Qe(n)==un}var Bf=Zt?yr(Zt):function(n){return Sf(n)&&If(n.length)&&!!It[Qe(n)]};var $f=bi(su),Pf=bi(function(n,t){return n<=t});function Df(n){if(!n)return[];if(wf(n))return Tf(n)?Lr(n):ri(n);if(Pt&&n[Pt])return function(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}(n[Pt]());var t=Mi(n);return(t==J?kr:t==rn?Sr:va)(n)}function Mf(n){return n?(n=qf(n))===W||n===-W?(n<0?-1:1)*T:n==n?n:0:0===n?n:0}function Ff(n){var t=Mf(n),r=t%1;return t==t?r?t-r:t:0}function Nf(n){return n?Ce(Ff(n),0,B):0}function qf(n){if("number"==typeof n)return n;if(Uf(n))return U;if(Rf(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=Rf(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=n.replace(Tn,"");var r=Kn.test(n);return r||Gn.test(n)?Et(n.slice(2),r?2:8):Zn.test(n)?U:+n}function Zf(n){return ei(n,oa(n))}function Kf(n){return null==n?"":Uu(n)}var Vf=ii(function(n,t){if(Ji(t)||wf(t))ei(t,ia(t),n);else for(var r in t)st.call(t,r)&&Re(n,r,t[r])}),Gf=ii(function(n,t){ei(t,oa(t),n)}),Hf=ii(function(n,t,r,e){ei(t,oa(t),n,e)}),Jf=ii(function(n,t,r,e){ei(t,ia(t),n,e)}),Yf=Si(We);var Qf=ju(function(n,t){n=rt(n);var r=-1,e=t.length,u=e>2?t[2]:i;for(u&&Ki(t[0],t[1],u)&&(e=1);++r1),t}),ei(n,Ei(n),r),e&&(r=Te(r,h|p|v,Ii));for(var u=t.length;u--;)$u(r,t[u]);return r});var la=Si(function(n,t){return null==n?{}:function(n,t){return du(n,t,function(t,r){return ta(n,r)})}(n,t)});function sa(n,t){if(null==n)return{};var r=nr(Ei(n),function(n){return[n]});return t=Ti(t),du(n,r,function(n,r){return t(n,r[0])})}var ha=ji(ia),pa=ji(oa);function va(n){return null==n?[]:dr(n,ia(n))}var _a=ci(function(n,t,r){return t=t.toLowerCase(),n+(r?ga(t):t)});function ga(n){return Aa(Kf(n).toLowerCase())}function ya(n){return(n=Kf(n))&&n.replace(Jn,xr).replace(wt,"")}var da=ci(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),ba=ci(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),wa=ai("toLowerCase");var ma=ci(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()});var xa=ci(function(n,t,r){return n+(r?" ":"")+Aa(t)});var ja=ci(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Aa=ai("toUpperCase");function Oa(n,t,r){return n=Kf(n),(t=r?i:t)===i?function(n){return At.test(n)}(n)?function(n){return n.match(xt)||[]}(n):function(n){return n.match(Mn)||[]}(n):n.match(t)||[]}var ka=ju(function(n,t){try{return Kt(n,i,t)}catch(n){return Af(n)?n:new Xn(n)}}),Ia=Si(function(n,t){return Gt(t,function(t){t=co(t),Le(n,t,rf(n[t],n))}),n});function Ra(n){return function(){return n}}var Sa=hi(),za=hi(!0);function Ea(n){return n}function La(n){return au("function"==typeof n?n:Te(n,h))}var Wa=ju(function(n,t){return function(r){return eu(r,n,t)}}),Ca=ju(function(n,t){return function(r){return eu(n,r,t)}});function Ta(n,t,r){var e=ia(t),u=He(t,e);null!=r||Rf(t)&&(u.length||!e.length)||(r=t,t=n,n=this,u=He(t,ia(t)));var i=!(Rf(r)&&"chain"in r&&!r.chain),o=Of(n);return Gt(u,function(r){var e=t[r];n[r]=e,o&&(n.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=n(this.__wrapped__),u=r.__actions__=ri(this.__actions__);return u.push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,tr([this.value()],arguments))})}),n}function Ua(){}var Ba=gi(nr),$a=gi(Jt),Pa=gi(ur);function Da(n){return Vi(n)?hr(co(n)):function(n){return function(t){return Je(t,n)}}(n)}var Ma=di(),Fa=di(!0);function Na(){return[]}function qa(){return!1}var Za=_i(function(n,t){return n+t},0),Ka=mi("ceil"),Va=_i(function(n,t){return n/t},1),Ga=mi("floor");var Ha,Ja=_i(function(n,t){return n*t},1),Ya=mi("round"),Qa=_i(function(n,t){return n-t},0);return pe.after=function(n,t){if("function"!=typeof t)throw new it(a);return n=Ff(n),function(){if(--n<1)return t.apply(this,arguments)}},pe.ary=nf,pe.assign=Vf,pe.assignIn=Gf,pe.assignInWith=Hf,pe.assignWith=Jf,pe.at=Yf,pe.before=tf,pe.bind=rf,pe.bindAll=Ia,pe.bindKey=ef,pe.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return df(n)?n:[n]},pe.chain=Po,pe.chunk=function(n,t,r){t=(r?Ki(n,t,r):t===i)?1:Zr(Ff(t),0);var u=null==n?0:n.length;if(!u||t<1)return[];for(var o=0,f=0,a=e($r(u/t));ou?0:u+r),(e=e===i||e>u?u:Ff(e))<0&&(e+=u),e=r>e?0:Nf(e);r>>0)?(n=Kf(n))&&("string"==typeof t||null!=t&&!Wf(t))&&!(t=Uu(t))&&Or(n)?Gu(Lr(n),0,r):n.split(t,r):[]},pe.spread=function(n,t){if("function"!=typeof n)throw new it(a);return t=null==t?0:Zr(Ff(t),0),ju(function(r){var e=r[t],u=Gu(r,0,t);return e&&tr(u,e),Kt(n,this,u)})},pe.tail=function(n){var t=null==n?0:n.length;return t?zu(n,1,t):[]},pe.take=function(n,t,r){return n&&n.length?zu(n,0,(t=r||t===i?1:Ff(t))<0?0:t):[]},pe.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?zu(n,(t=e-(t=r||t===i?1:Ff(t)))<0?0:t,e):[]},pe.takeRightWhile=function(n,t){return n&&n.length?Du(n,Ti(t,3),!1,!0):[]},pe.takeWhile=function(n,t){return n&&n.length?Du(n,Ti(t,3)):[]},pe.tap=function(n,t){return t(n),n},pe.throttle=function(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new it(a);return Rf(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),uf(n,t,{leading:e,maxWait:t,trailing:u})},pe.thru=Do,pe.toArray=Df,pe.toPairs=ha,pe.toPairsIn=pa,pe.toPath=function(n){return df(n)?nr(n,co):Uf(n)?[n]:ri(ao(Kf(n)))},pe.toPlainObject=Zf,pe.transform=function(n,t,r){var e=df(n),u=e||xf(n)||Bf(n);if(t=Ti(t,4),null==r){var i=n&&n.constructor;r=u?e?new i:[]:Rf(n)&&Of(i)?ve(Lt(n)):{}}return(u?Gt:Ve)(n,function(n,e,u){return t(r,n,e,u)}),r},pe.unary=function(n){return nf(n,1)},pe.union=Ro,pe.unionBy=So,pe.unionWith=zo,pe.uniq=function(n){return n&&n.length?Bu(n):[]},pe.uniqBy=function(n,t){return n&&n.length?Bu(n,Ti(t,2)):[]},pe.uniqWith=function(n,t){return t="function"==typeof t?t:i,n&&n.length?Bu(n,i,t):[]},pe.unset=function(n,t){return null==n||$u(n,t)},pe.unzip=Eo,pe.unzipWith=Lo,pe.update=function(n,t,r){return null==n?n:Pu(n,t,Zu(r))},pe.updateWith=function(n,t,r,e){return e="function"==typeof e?e:i,null==n?n:Pu(n,t,Zu(r),e)},pe.values=va,pe.valuesIn=function(n){return null==n?[]:dr(n,oa(n))},pe.without=Wo,pe.words=Oa,pe.wrap=function(n,t){return sf(Zu(t),n)},pe.xor=Co,pe.xorBy=To,pe.xorWith=Uo,pe.zip=Bo,pe.zipObject=function(n,t){return Nu(n||[],t||[],Re)},pe.zipObjectDeep=function(n,t){return Nu(n||[],t||[],ku)},pe.zipWith=$o,pe.entries=ha,pe.entriesIn=pa,pe.extend=Gf,pe.extendWith=Hf,Ta(pe,pe),pe.add=Za,pe.attempt=ka,pe.camelCase=_a,pe.capitalize=ga,pe.ceil=Ka,pe.clamp=function(n,t,r){return r===i&&(r=t,t=i),r!==i&&(r=(r=qf(r))==r?r:0),t!==i&&(t=(t=qf(t))==t?t:0),Ce(qf(n),t,r)},pe.clone=function(n){return Te(n,v)},pe.cloneDeep=function(n){return Te(n,h|v)},pe.cloneDeepWith=function(n,t){return Te(n,h|v,t="function"==typeof t?t:i)},pe.cloneWith=function(n,t){return Te(n,v,t="function"==typeof t?t:i)},pe.conformsTo=function(n,t){return null==t||Ue(n,t,ia(t))},pe.deburr=ya,pe.defaultTo=function(n,t){return null==n||n!=n?t:n},pe.divide=Va,pe.endsWith=function(n,t,r){n=Kf(n),t=Uu(t);var e=n.length,u=r=r===i?e:Ce(Ff(r),0,e);return(r-=t.length)>=0&&n.slice(r,u)==t},pe.eq=vf,pe.escape=function(n){return(n=Kf(n))&&kn.test(n)?n.replace(An,jr):n},pe.escapeRegExp=function(n){return(n=Kf(n))&&Cn.test(n)?n.replace(Wn,"\\$&"):n},pe.every=function(n,t,r){var e=df(n)?Jt:Me;return r&&Ki(n,t,r)&&(t=i),e(n,Ti(t,3))},pe.find=No,pe.findIndex=_o,pe.findKey=function(n,t){return or(n,Ti(t,3),Ve)},pe.findLast=qo,pe.findLastIndex=go,pe.findLastKey=function(n,t){return or(n,Ti(t,3),Ge)},pe.floor=Ga,pe.forEach=Zo,pe.forEachRight=Ko,pe.forIn=function(n,t){return null==n?n:Ze(n,Ti(t,3),oa)},pe.forInRight=function(n,t){return null==n?n:Ke(n,Ti(t,3),oa)},pe.forOwn=function(n,t){return n&&Ve(n,Ti(t,3))},pe.forOwnRight=function(n,t){return n&&Ge(n,Ti(t,3))},pe.get=na,pe.gt=_f,pe.gte=gf,pe.has=function(n,t){return null!=n&&Fi(n,t,nu)},pe.hasIn=ta,pe.head=bo,pe.identity=Ea,pe.includes=function(n,t,r,e){n=wf(n)?n:va(n),r=r&&!e?Ff(r):0;var u=n.length;return r<0&&(r=Zr(u+r,0)),Tf(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&ar(n,t,r)>-1},pe.indexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:Ff(r);return u<0&&(u=Zr(e+u,0)),ar(n,t,u)},pe.inRange=function(n,t,r){return t=Mf(t),r===i?(r=t,t=0):r=Mf(r),function(n,t,r){return n>=Kr(t,r)&&n=-C&&n<=C},pe.isSet=Cf,pe.isString=Tf,pe.isSymbol=Uf,pe.isTypedArray=Bf,pe.isUndefined=function(n){return n===i},pe.isWeakMap=function(n){return Sf(n)&&Mi(n)==fn},pe.isWeakSet=function(n){return Sf(n)&&Qe(n)==an},pe.join=function(n,t){return null==n?"":Nr.call(n,t)},pe.kebabCase=da,pe.last=jo,pe.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;return r!==i&&(u=(u=Ff(r))<0?Zr(e+u,0):Kr(u,e-1)),t==t?function(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}(n,t,u):fr(n,lr,u,!0)},pe.lowerCase=ba,pe.lowerFirst=wa,pe.lt=$f,pe.lte=Pf,pe.max=function(n){return n&&n.length?Fe(n,Ea,Xe):i},pe.maxBy=function(n,t){return n&&n.length?Fe(n,Ti(t,2),Xe):i},pe.mean=function(n){return sr(n,Ea)},pe.meanBy=function(n,t){return sr(n,Ti(t,2))},pe.min=function(n){return n&&n.length?Fe(n,Ea,su):i},pe.minBy=function(n,t){return n&&n.length?Fe(n,Ti(t,2),su):i},pe.stubArray=Na,pe.stubFalse=qa,pe.stubObject=function(){return{}},pe.stubString=function(){return""},pe.stubTrue=function(){return!0},pe.multiply=Ja,pe.nth=function(n,t){return n&&n.length?gu(n,Ff(t)):i},pe.noConflict=function(){return Ct._===this&&(Ct._=gt),this},pe.noop=Ua,pe.now=Xo,pe.pad=function(n,t,r){n=Kf(n);var e=(t=Ff(t))?Er(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return yi(Pr(u),r)+n+yi($r(u),r)},pe.padEnd=function(n,t,r){n=Kf(n);var e=(t=Ff(t))?Er(n):0;return t&&et){var e=n;n=t,t=e}if(r||n%1||t%1){var u=Hr();return Kr(n+u*(t-n+zt("1e-"+((u+"").length-1))),t)}return mu(n,t)},pe.reduce=function(n,t,r){var e=df(n)?rr:vr,u=arguments.length<3;return e(n,Ti(t,4),r,u,Pe)},pe.reduceRight=function(n,t,r){var e=df(n)?er:vr,u=arguments.length<3;return e(n,Ti(t,4),r,u,De)},pe.repeat=function(n,t,r){return t=(r?Ki(n,t,r):t===i)?1:Ff(t),xu(Kf(n),t)},pe.replace=function(){var n=arguments,t=Kf(n[0]);return n.length<3?t:t.replace(n[1],n[2])},pe.result=function(n,t,r){var e=-1,u=(t=Ku(t,n)).length;for(u||(u=1,n=i);++eC)return[];var r=B,e=Kr(n,B);t=Ti(t),n-=B;for(var u=gr(e,t);++r=o)return n;var a=r-Er(e);if(a<1)return e;var c=f?Gu(f,0,a).join(""):n.slice(0,a);if(u===i)return c+e;if(f&&(a+=c.length-a),Wf(u)){if(n.slice(a).search(u)){var l,s=c;for(u.global||(u=et(u.source,Kf(qn.exec(u))+"g")),u.lastIndex=0;l=u.exec(s);)var h=l.index;c=c.slice(0,h===i?a:h)}}else if(n.indexOf(Uu(u),a)!=a){var p=c.lastIndexOf(u);p>-1&&(c=c.slice(0,p))}return c+e},pe.unescape=function(n){return(n=Kf(n))&&On.test(n)?n.replace(jn,Wr):n},pe.uniqueId=function(n){var t=++ht;return Kf(n)+t},pe.upperCase=ja,pe.upperFirst=Aa,pe.each=Zo,pe.eachRight=Ko,pe.first=bo,Ta(pe,(Ha={},Ve(pe,function(n,t){st.call(pe.prototype,t)||(Ha[t]=n)}),Ha),{chain:!1}),pe.VERSION="4.17.15",Gt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){pe[n].placeholder=pe}),Gt(["drop","take"],function(n,t){ye.prototype[n]=function(r){r=r===i?1:Zr(Ff(r),0);var e=this.__filtered__&&!t?new ye(this):this.clone();return e.__filtered__?e.__takeCount__=Kr(r,e.__takeCount__):e.__views__.push({size:Kr(r,B),type:n+(e.__dir__<0?"Right":"")}),e},ye.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),Gt(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==E||3==r;ye.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:Ti(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),Gt(["head","last"],function(n,t){var r="take"+(t?"Right":"");ye.prototype[n]=function(){return this[r](1).value()[0]}}),Gt(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");ye.prototype[n]=function(){return this.__filtered__?new ye(this):this[r](1)}}),ye.prototype.compact=function(){return this.filter(Ea)},ye.prototype.find=function(n){return this.filter(n).head()},ye.prototype.findLast=function(n){return this.reverse().find(n)},ye.prototype.invokeMap=ju(function(n,t){return"function"==typeof n?new ye(this):this.map(function(r){return eu(r,n,t)})}),ye.prototype.reject=function(n){return this.filter(cf(Ti(n)))},ye.prototype.slice=function(n,t){n=Ff(n);var r=this;return r.__filtered__&&(n>0||t<0)?new ye(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==i&&(r=(t=Ff(t))<0?r.dropRight(-t):r.take(t-n)),r)},ye.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},ye.prototype.toArray=function(){return this.take(B)},Ve(ye.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=pe[e?"take"+("last"==t?"Right":""):t],o=e||/^find/.test(t);u&&(pe.prototype[t]=function(){var t=this.__wrapped__,f=e?[1]:arguments,a=t instanceof ye,c=f[0],l=a||df(t),s=function(n){var t=u.apply(pe,tr([n],f));return e&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(a=l=!1);var h=this.__chain__,p=!!this.__actions__.length,v=o&&!h,_=a&&!p;if(!o&&l){t=_?t:new ye(this);var g=n.apply(t,f);return g.__actions__.push({func:Do,args:[s],thisArg:i}),new ge(g,h)}return v&&_?n.apply(this,f):(g=this.thru(s),v?e?g.value()[0]:g.value():g)})}),Gt(["pop","push","shift","sort","splice","unshift"],function(n){var t=ot[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);pe.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(df(u)?u:[],n)}return this[r](function(r){return t.apply(df(r)?r:[],n)})}}),Ve(ye.prototype,function(n,t){var r=pe[t];if(r){var e=r.name+"";st.call(ue,e)||(ue[e]=[]),ue[e].push({name:t,func:r})}}),ue[pi(i,d).name]=[{name:"wrapper",func:i}],ye.prototype.clone=function(){var n=new ye(this.__wrapped__);return n.__actions__=ri(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=ri(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=ri(this.__views__),n},ye.prototype.reverse=function(){if(this.__filtered__){var n=new ye(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},ye.prototype.value=function(){var n=this.__wrapped__.value(),t=this.__dir__,r=df(n),e=t<0,u=r?n.length:0,i=function(n,t,r){var e=-1,u=r.length;for(;++e=this.__values__.length;return{done:n,value:n?i:this.__values__[this.__index__++]}},pe.prototype.plant=function(n){for(var t,r=this;r instanceof _e;){var e=so(r);e.__index__=0,e.__values__=i,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t},pe.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof ye){var t=n;return this.__actions__.length&&(t=new ye(this)),(t=t.reverse()).__actions__.push({func:Do,args:[Io],thisArg:i}),new ge(t,this.__chain__)}return this.thru(Io)},pe.prototype.toJSON=pe.prototype.valueOf=pe.prototype.value=function(){return Mu(this.__wrapped__,this.__actions__)},pe.prototype.first=pe.prototype.head,Pt&&(pe.prototype[Pt]=function(){return this}),pe}();Ct._=Cr,(u=function(){return Cr}.call(t,r,t,e))===i||(e.exports=u)}).call(this)}).call(this,r(1),r(2)(n))},function(n,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(n){"object"==typeof window&&(r=window)}n.exports=r},function(n,t){n.exports=function(n){return n.webpackPolyfill||(n.deprecate=function(){},n.paths=[],n.children||(n.children=[]),Object.defineProperty(n,"loaded",{enumerable:!0,get:function(){return n.l}}),Object.defineProperty(n,"id",{enumerable:!0,get:function(){return n.i}}),n.webpackPolyfill=1),n}},function(n,t,r){"use strict";r.r(t);var e=function(n){return n.substring(0,1).toUpperCase()+n.substring(1,n.length)},u=r(0),i=r.n(u);console.log(e("hola mundo")),console.log(i.a.capitalize("hola mundo, desde lodash"))}]); -------------------------------------------------------------------------------- /02-modulos/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Módulos 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /02-modulos/main.js: -------------------------------------------------------------------------------- 1 | import capitalizar from './capitalizar.js'; 2 | const _ = require('lodash'); 3 | 4 | console.log(capitalizar("hola mundo")); -------------------------------------------------------------------------------- /02-modulos/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "modulos", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "main.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "install": "^0.13.0", 14 | "lodash": "^4.17.15", 15 | "npm": "^6.10.3" 16 | }, 17 | "devDependencies": { 18 | "webpack": "^4.39.2", 19 | "webpack-cli": "^3.3.6" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /02-modulos/src/capitalizar.js: -------------------------------------------------------------------------------- 1 | function capitalizar(frase) { 2 | return frase.substring(0, 1).toUpperCase() + frase.substring(1, frase.length); 3 | } 4 | 5 | export default capitalizar; -------------------------------------------------------------------------------- /02-modulos/src/index.js: -------------------------------------------------------------------------------- 1 | import capitalizar from './capitalizar.js'; 2 | // const _ = require('lodash'); 3 | import _ from 'lodash'; 4 | 5 | console.log(capitalizar("hola mundo")); 6 | 7 | console.log(_.capitalize("hola mundo, desde lodash")); -------------------------------------------------------------------------------- /03-spread_rest/spread-rest.js: -------------------------------------------------------------------------------- 1 | const mapState = { 2 | loggedIn() { 3 | return true 4 | }, 5 | member() { 6 | return false 7 | } 8 | } 9 | 10 | const computed = { 11 | ...mapState, 12 | computedProp() { 13 | return null 14 | } 15 | } 16 | 17 | console.log(computed); 18 | 19 | // SPREAD 20 | // Expande valores (string o matriz) allá donde se esperan argumentos(función) o elementos(matrices) 21 | const numeros = [1, 2, 3, 4, 5]; 22 | console.log(...numeros); 23 | 24 | const oracion = "Hola mundo"; 25 | console.log(...oracion); 26 | 27 | // Pasar matrices como argumentos 28 | function sumar(a, b, c, d ,e) { 29 | return a + b + c + d + e; 30 | } 31 | 32 | //console.log(sumar.apply(null, numeros)); 33 | console.log(sumar(...numeros)); 34 | 35 | // Clonar matrices y objetos 36 | const numerosCopia = [...numeros]; 37 | //console.log(numerosCopia); 38 | numeros.push(6); 39 | console.log(numeros, numerosCopia); 40 | 41 | const datos = {nombre: 'Juan', ciudad: 'Valencia'}; 42 | const datosCopia = {...datos}; 43 | console.log(datosCopia); 44 | 45 | // Fusionar matrices y objetos 46 | const preferencias = {nombre: 'Andrés', cerveza: 'Judas', color: 'rojo'}; 47 | const persona = {...datos, ...preferencias}; 48 | console.log(persona); 49 | 50 | 51 | // REST 52 | // Representa un número infinito de argumentos como matriz 53 | function sumar2(...argumentos) { 54 | return argumentos.reduce((actual, total) => actual + total); 55 | } 56 | 57 | // Se puede usar spread varias veces 58 | const numeros2 = [21, 22, 66]; 59 | console.log(sumar2(...numeros, ...[55], ...numeros2, 4, 88, 99)); -------------------------------------------------------------------------------- /04-classes/clasess.js: -------------------------------------------------------------------------------- 1 | // Class declaration 2 | class Task { 3 | // Constructor 4 | constructor(title) { 5 | if (!title) throw new Error("We need a title!!!"); 6 | this.title = title; 7 | this.completed = false; 8 | } 9 | } 10 | 11 | // Creamos una instancia de Task 12 | const tarea = new Task("Aprender JavaScript"); 13 | console.log(tarea instanceof Task); 14 | 15 | const TasksList = class { 16 | constructor() { 17 | this.tasks = [ 18 | {title: 'Aprender Firebase', completed: false}, 19 | {title: 'Aprender CSS', completed: true}, 20 | {title: 'Aprender HTML', completed: false}, 21 | ] 22 | } 23 | 24 | // Getters 25 | get uncompleted() { 26 | return [...this.tasks].filter(task => !task.completed); 27 | } 28 | 29 | get completed() { 30 | return [...this.tasks].filter(task => task.completed); 31 | } 32 | 33 | // Setters 34 | set addTask(task) { 35 | this.tasks.push(task) 36 | } 37 | 38 | // Métodos 39 | search(search) { 40 | return this.tasks.find(task=> task.title.includes(search)); 41 | } 42 | 43 | removeTask(index) { 44 | this.tasks.splice(index, 1); 45 | } 46 | 47 | // Static 48 | static normaliceTask(title) { 49 | title = title.trim(); 50 | return title.charAt(0).toUpperCase() + title.substring(1); 51 | } 52 | } 53 | 54 | 55 | const tareas = new TasksList() 56 | 57 | const tarea2 = new Task("Aprender Vuex"); 58 | tareas.addTask = {...tarea2}; 59 | 60 | console.log(tareas.search("Vuex")); 61 | 62 | console.log(tareas.constructor.normaliceTask(" esto es una tarea ")) 63 | 64 | // Subclassing 65 | class Reminder extends Task { 66 | constructor(title, date) { 67 | super(title); 68 | this.date = date; 69 | } 70 | 71 | get duration() { 72 | return `${this.title} finaliza el ${this.date}`; 73 | } 74 | } 75 | 76 | const producir = new Reminder("Producir lección eterna", "8 de Febrero de 2020"); 77 | console.log(producir.duration) -------------------------------------------------------------------------------- /05-promises/promises.js: -------------------------------------------------------------------------------- 1 | // Creación de promesa 2 | const buyFood = new Promise((resolve, reject) => { 3 | // Ejecutor 4 | resolve("Aquí tienes tu comida 😁"); 5 | //reject(Error("Error procesando el pago 🙀")); 6 | }) 7 | 8 | buyFood 9 | .then(result => console.log(result)) 10 | .catch(error => console.error(error)) 11 | .finally(() => console.info("Proceso finalizado")) 12 | 13 | // Manejo de varias promesas 14 | const payFood = new Promise((resolve, reject) => { 15 | // Son acciones asíncronas 16 | setTimeout(() => { 17 | Promise.race([paypal, amex]).then(payProvider => { 18 | resolve({done: true, payProvider, customerID: 3123123123123}) 19 | }) 20 | //resolve({done: true, customerID: 3123123123123}) 21 | //reject("Problema con el pago"); 22 | }, 300); 23 | }) 24 | 25 | // Proveedores de pago (Promise.race) 26 | const paypal = new Promise((resolve, reject) => { 27 | setTimeout(() => { 28 | resolve("Paypal"); 29 | }, 4000); 30 | }) 31 | 32 | const amex = new Promise((resolve, reject) => { 33 | setTimeout(() => { 34 | resolve("Amex"); 35 | }, 1000); 36 | }) 37 | 38 | const getTransport = new Promise((resolve, reject) => { 39 | setTimeout(() => { 40 | resolve({bikerID: 4324234, distance: 3000}) 41 | //reject("Problema con el repartidor") 42 | }, 5000); 43 | }) 44 | 45 | function deliverFood() { 46 | // Then flow 47 | // payFood 48 | // .then(paymentInfo => { 49 | // console.log(paymentInfo); 50 | // return getTransport; // Retorna otra promesa, podemos encadenar "then" 51 | // }) 52 | // .then(riderInfo => { 53 | // let {bikerID, distance} = riderInfo; 54 | // console.log(`El biker ${bikerID} se encuentra a ${distance} metros`); 55 | // }) 56 | // .catch(error => {console.error(error)}) 57 | // .finally(() => console.log("Proceso de compra de comida finalizado")) 58 | 59 | // Promise all 60 | Promise.all([payFood, getTransport]) 61 | .then(order => console.log(order)) 62 | .catch(error => console.error(error)) 63 | } 64 | 65 | deliverFood() -------------------------------------------------------------------------------- /06-fetch/fetch.js: -------------------------------------------------------------------------------- 1 | // API endpoint 2 | const url = "https://jsonplaceholder.typicode.com/posts/"; 3 | 4 | // Sintaxis 5 | // fetch(url, [options]) 6 | 7 | // GET request 8 | fetch(url) 9 | // Examinando Response object 10 | // .then(response => console.log(response)); 11 | .then(response => { 12 | console.log(response.headers.get("Content-Type")); 13 | for (const [key, val] of response.headers) { 14 | console.log(key, val); 15 | } 16 | return response.json(); 17 | }) 18 | .then(response => console.log(response)) 19 | .catch(error => console.error(error.message)); 20 | 21 | // POST request 22 | // Cuerpo a enviar 23 | const payload = { 24 | id: 323123123, 25 | name: "Juan Andrés", 26 | color: "red" 27 | }; 28 | 29 | // Opciones del request 30 | const options = { 31 | method: "POST", 32 | headers: { 33 | // Enviamos JSON en el cuerpo 34 | "Content-type": "application/json; charset=UTF-8" 35 | }, 36 | body: JSON.stringify(payload) 37 | }; 38 | 39 | // Request en sí 40 | fetch(url, options) 41 | .then(response => console.log(response)) 42 | .catch(error => console.error(error)); 43 | -------------------------------------------------------------------------------- /06-fetch/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | fetch API 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /07-async-await/async-await.js: -------------------------------------------------------------------------------- 1 | // Async keyword 2 | async function myFunction() { 3 | //return "Hello World"; 4 | return Promise.resolve("Hello World"); 5 | } 6 | 7 | myFunction().then(data => console.log(data)); 8 | 9 | // Await keyword 10 | function getWeather() { 11 | return new Promise((resolve, reject) => { 12 | //setTimeout(() => reject("Can't connect 🙀"), 2000); 13 | setTimeout(() => resolve("Mostly cloudy: 13C"), 2000); 14 | }); 15 | } 16 | 17 | function getTraffic() { 18 | return new Promise((resolve, reject) => { 19 | setTimeout(() => resolve("Traffic fluid"), 2000); 20 | }); 21 | } 22 | 23 | async function travelPlan() { 24 | // getWeather() 25 | // .then(data => { 26 | // console.log(data); 27 | // return getTraffic(); 28 | // }) 29 | // .then(data => console.log(data)); 30 | // } 31 | 32 | // const weather = await getWeather(); 33 | // const traffic = await getTraffic(); 34 | // return [weather, traffic]; 35 | 36 | try { 37 | const weather = getWeather(); 38 | const traffic = getTraffic(); 39 | const plan = await Promise.all([weather, traffic]); 40 | throw "Error"; 41 | return plan; 42 | } catch (error) { 43 | throw error; 44 | } 45 | } 46 | 47 | travelPlan() 48 | .then(data => console.log(data)) 49 | .catch(error => console.error(error)); 50 | -------------------------------------------------------------------------------- /08-mejores-objetos/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JS 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /08-mejores-objetos/mejores-objetos.js: -------------------------------------------------------------------------------- 1 | const nombre = "Juan"; 2 | const color = "rojo"; 3 | const ciudad = "Valencia"; 4 | const lenguaje = "JavaScript"; 5 | 6 | const persona = { 7 | nombre, 8 | color, 9 | ciudad, 10 | lenguaje, 11 | [ciudad + "CP"]: 46006, 12 | saludar() { 13 | console.log(`Hola me llamo ${this.nombre}`); 14 | } 15 | }; 16 | const [nombre2, color2, ciudad2, lenguaje2] = Object.values(persona); 17 | 18 | Object.entries(persona).forEach(([key, value]) => { 19 | console.log(`${key} : ${value}`); 20 | }); 21 | -------------------------------------------------------------------------------- /09-for-of-iterables/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JS 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /09-for-of-iterables/iterables-looping.js: -------------------------------------------------------------------------------- 1 | // for...of 2 | const colores = ["Rojo", "Azul", "Verde", "Amarillo"]; 3 | for (let color of colores) { 4 | console.log(color); 5 | } 6 | 7 | const iterator = colores[Symbol.iterator](); 8 | 9 | const persona = { 10 | nombre: "Juan", 11 | ciudad: "Valencia", 12 | color: "rojo" 13 | }; 14 | 15 | // for (let prop of persona) { 16 | // console.log(prop); 17 | // } 18 | 19 | for (let [key, value] of Object.entries(persona)) { 20 | console.log(key, value); 21 | } 22 | 23 | const aprender = { 24 | // tecnologías y herramienta 25 | vue: ["Vue3", "Nuxt", "Grindsome"], 26 | js: ["ESNEXT", "Patterns", "Testing"], 27 | css: ["Tailwind", "BEM", "SubGRID"] 28 | }; 29 | 30 | aprender[Symbol.iterator] = function() { 31 | // Por cada matriz con herramientas, ir retornando cada una de ella 32 | let indiceTecnologia = 0; 33 | let indiceHeramienta = 0; 34 | const tecnologias = Object.values(this); 35 | return { 36 | next() { 37 | const tecnologia = tecnologias[indiceTecnologia]; 38 | 39 | // Comprobar que haya más herramientas 40 | if (!(indiceHeramienta < tecnologia.length)) { 41 | indiceTecnologia++; 42 | indiceHeramienta = 0; 43 | } 44 | 45 | // Comprobar que haya más tecnologías 46 | if (!(indiceTecnologia < tecnologias.length)) { 47 | return { 48 | value: undefined, 49 | done: true 50 | }; 51 | } 52 | 53 | return { 54 | value: tecnologia[indiceHeramienta++], 55 | done: false 56 | }; 57 | } 58 | }; 59 | }; 60 | 61 | for (let herramienta of aprender) { 62 | console.log(herramienta); 63 | } 64 | -------------------------------------------------------------------------------- /10-mejores-matrices/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JS 8 | 9 | 10 | 11 | 12 |
    13 |
  • JavaScript
  • 14 |
  • Vue
  • 15 |
  • Nuxt
  • 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /10-mejores-matrices/mejores-matrices.js: -------------------------------------------------------------------------------- 1 | // Array from 2 | const frase = "Hola mundo"; 3 | const caracteres = Array.from(frase); 4 | 5 | // const listado = document.querySelectorAll("li"); 6 | // const listado = Array.from(document.querySelectorAll("li")); 7 | // const aprender = listado.map(elemento => elemento.textContent); 8 | 9 | const aprender = Array.from( 10 | document.querySelectorAll("li"), 11 | elemento => elemento.textContent 12 | ); 13 | 14 | function total(num1, num2, num3, num4, num5, num6) { 15 | return Array.from(arguments).reduce((ant, sig) => ant + sig, 0); 16 | } 17 | 18 | console.log(total(12312, 3424, 5345345, 312312, 1231, 564645)); 19 | 20 | const users = [ 21 | { 22 | gender: "female", 23 | name: { 24 | title: "Miss", 25 | first: "Asta", 26 | last: "Christiansen" 27 | }, 28 | location: { 29 | street: { 30 | number: 5081, 31 | name: "Sneppevej" 32 | }, 33 | city: "Nykøbing F", 34 | state: "Nordjylland", 35 | country: "Denmark", 36 | postcode: 12136, 37 | coordinates: { 38 | latitude: "-29.0201", 39 | longitude: "103.6408" 40 | }, 41 | timezone: { 42 | offset: "+5:00", 43 | description: "Ekaterinburg, Islamabad, Karachi, Tashkent" 44 | } 45 | }, 46 | email: "asta.christiansen@example.com", 47 | login: { 48 | uuid: "123a8c89-0758-4e6e-ae86-03929aa3a418", 49 | username: "happybear273", 50 | password: "limited", 51 | salt: "BvH6A6k6", 52 | md5: "aa77bc3647797908f0523f4ea95ce3fc", 53 | sha1: "0c464db89208967214c6610af7fbce992eccd077", 54 | sha256: "757f48a3508ae70b1456360eff00ee5ac1b2338d0d9196b155dabc4ff0614e24" 55 | }, 56 | dob: { 57 | date: "1976-10-12T06:59:24.554Z", 58 | age: 44 59 | }, 60 | registered: { 61 | date: "2005-01-04T05:53:07.165Z", 62 | age: 15 63 | }, 64 | phone: "66162155", 65 | cell: "87233770", 66 | id: { 67 | name: "CPR", 68 | value: "121076-7844" 69 | }, 70 | picture: { 71 | large: "https://randomuser.me/api/portraits/women/59.jpg", 72 | medium: "https://randomuser.me/api/portraits/med/women/59.jpg", 73 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/59.jpg" 74 | }, 75 | nat: "DK" 76 | }, 77 | { 78 | gender: "female", 79 | name: { 80 | title: "Mrs", 81 | first: "Karen", 82 | last: "Nichols" 83 | }, 84 | location: { 85 | street: { 86 | number: 9621, 87 | name: "St. John’S Road" 88 | }, 89 | city: "Kingston upon Hull", 90 | state: "Dyfed", 91 | country: "United Kingdom", 92 | postcode: "C84 1SF", 93 | coordinates: { 94 | latitude: "16.8810", 95 | longitude: "108.3179" 96 | }, 97 | timezone: { 98 | offset: "+3:00", 99 | description: "Baghdad, Riyadh, Moscow, St. Petersburg" 100 | } 101 | }, 102 | email: "karen.nichols@example.com", 103 | login: { 104 | uuid: "c346cc1b-e778-498a-98fc-6512f7962680", 105 | username: "greendog231", 106 | password: "81fukkc", 107 | salt: "j7EMykAI", 108 | md5: "7dd459db43dd0ee8675413c1e48680cf", 109 | sha1: "958daf4f551b79abade562150c6f81e6a03be189", 110 | sha256: "882654da43d51ae0f53a2c9a4b28eb4fbc43607477bd1e6c594d028dbcdda5a4" 111 | }, 112 | dob: { 113 | date: "1998-02-17T07:32:30.798Z", 114 | age: 22 115 | }, 116 | registered: { 117 | date: "2004-01-02T03:38:48.757Z", 118 | age: 16 119 | }, 120 | phone: "022 5978 8992", 121 | cell: "0738-031-204", 122 | id: { 123 | name: "NINO", 124 | value: "MY 42 87 52 N" 125 | }, 126 | picture: { 127 | large: "https://randomuser.me/api/portraits/women/80.jpg", 128 | medium: "https://randomuser.me/api/portraits/med/women/80.jpg", 129 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/80.jpg" 130 | }, 131 | nat: "GB" 132 | }, 133 | { 134 | gender: "female", 135 | name: { 136 | title: "Miss", 137 | first: "Sofia", 138 | last: "Olsen" 139 | }, 140 | location: { 141 | street: { 142 | number: 8983, 143 | name: "Hirsevænget" 144 | }, 145 | city: "Gørløse", 146 | state: "Syddanmark", 147 | country: "Denmark", 148 | postcode: 94453, 149 | coordinates: { 150 | latitude: "-20.1172", 151 | longitude: "-119.1971" 152 | }, 153 | timezone: { 154 | offset: "+4:00", 155 | description: "Abu Dhabi, Muscat, Baku, Tbilisi" 156 | } 157 | }, 158 | email: "sofia.olsen@example.com", 159 | login: { 160 | uuid: "2f1d0134-b33b-47bd-9a09-b144d9f37224", 161 | username: "bigrabbit664", 162 | password: "ariana", 163 | salt: "MPECa1zp", 164 | md5: "e9ec25ca598c68afa36fe24e4f9c0db9", 165 | sha1: "868308c4736e2b2bf3c85576eabb6907e4d6aba4", 166 | sha256: "6f4c583915ce02c4a523358e22d8613785f5744ce02a6e4efcca4e8b2645a0c6" 167 | }, 168 | dob: { 169 | date: "1982-04-08T00:08:31.952Z", 170 | age: 38 171 | }, 172 | registered: { 173 | date: "2010-10-26T08:06:42.483Z", 174 | age: 10 175 | }, 176 | phone: "28669984", 177 | cell: "82713354", 178 | id: { 179 | name: "CPR", 180 | value: "080482-2160" 181 | }, 182 | picture: { 183 | large: "https://randomuser.me/api/portraits/women/56.jpg", 184 | medium: "https://randomuser.me/api/portraits/med/women/56.jpg", 185 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/56.jpg" 186 | }, 187 | nat: "DK" 188 | }, 189 | { 190 | gender: "male", 191 | name: { 192 | title: "Mr", 193 | first: "Väinö", 194 | last: "Kotila" 195 | }, 196 | location: { 197 | street: { 198 | number: 9380, 199 | name: "Nordenskiöldinkatu" 200 | }, 201 | city: "Hyvinkää", 202 | state: "Ostrobothnia", 203 | country: "Finland", 204 | postcode: 79560, 205 | coordinates: { 206 | latitude: "56.6816", 207 | longitude: "-13.8552" 208 | }, 209 | timezone: { 210 | offset: "-8:00", 211 | description: "Pacific Time (US & Canada)" 212 | } 213 | }, 214 | email: "vaino.kotila@example.com", 215 | login: { 216 | uuid: "b01c06d9-6ed1-4c50-96b7-1dfde3fbebc0", 217 | username: "angryswan427", 218 | password: "hillbill", 219 | salt: "5vXD19jP", 220 | md5: "5683923eb4140a7a1615c9636e7c2d59", 221 | sha1: "563c59a08a563423b4d1746350b569ee5391459e", 222 | sha256: "f36fdf23206d7a42e1189c3c014c9f3c92838fed9a35bab620d03897e87d082d" 223 | }, 224 | dob: { 225 | date: "1956-02-29T21:28:45.826Z", 226 | age: 64 227 | }, 228 | registered: { 229 | date: "2016-04-09T12:12:51.136Z", 230 | age: 4 231 | }, 232 | phone: "04-913-065", 233 | cell: "045-501-93-98", 234 | id: { 235 | name: "HETU", 236 | value: "NaNNA339undefined" 237 | }, 238 | picture: { 239 | large: "https://randomuser.me/api/portraits/men/18.jpg", 240 | medium: "https://randomuser.me/api/portraits/med/men/18.jpg", 241 | thumbnail: "https://randomuser.me/api/portraits/thumb/men/18.jpg" 242 | }, 243 | nat: "FI" 244 | }, 245 | { 246 | gender: "male", 247 | name: { 248 | title: "Mr", 249 | first: "Thomas", 250 | last: "Park" 251 | }, 252 | location: { 253 | street: { 254 | number: 1581, 255 | name: "Frederick Ave" 256 | }, 257 | city: "Chipman", 258 | state: "Nova Scotia", 259 | country: "Canada", 260 | postcode: "U7K 2I0", 261 | coordinates: { 262 | latitude: "50.3530", 263 | longitude: "1.9533" 264 | }, 265 | timezone: { 266 | offset: "-5:00", 267 | description: "Eastern Time (US & Canada), Bogota, Lima" 268 | } 269 | }, 270 | email: "thomas.park@example.com", 271 | login: { 272 | uuid: "102104c7-6ac1-469a-b2ca-1fdfe2a3e749", 273 | username: "redleopard528", 274 | password: "reading", 275 | salt: "jaGgkj8C", 276 | md5: "b5f51d91325ca10367216cc5b5f58fc6", 277 | sha1: "d8c49a615bc890972d8e846a190c0cc5f6aba6d5", 278 | sha256: "99b083186f5c23072a6a12695db22f51b7b548e756bb22ccd5b6a7a259240b01" 279 | }, 280 | dob: { 281 | date: "1985-05-08T09:09:24.055Z", 282 | age: 35 283 | }, 284 | registered: { 285 | date: "2002-06-28T14:55:55.350Z", 286 | age: 18 287 | }, 288 | phone: "351-536-7569", 289 | cell: "608-857-4982", 290 | id: { 291 | name: "", 292 | value: null 293 | }, 294 | picture: { 295 | large: "https://randomuser.me/api/portraits/men/56.jpg", 296 | medium: "https://randomuser.me/api/portraits/med/men/56.jpg", 297 | thumbnail: "https://randomuser.me/api/portraits/thumb/men/56.jpg" 298 | }, 299 | nat: "CA" 300 | }, 301 | { 302 | gender: "female", 303 | name: { 304 | title: "Ms", 305 | first: "Marij", 306 | last: "Peterson" 307 | }, 308 | location: { 309 | street: { 310 | number: 9752, 311 | name: "Bergumermeerstraat" 312 | }, 313 | city: "Elsendorp", 314 | state: "Utrecht", 315 | country: "Netherlands", 316 | postcode: 94928, 317 | coordinates: { 318 | latitude: "-14.4505", 319 | longitude: "-131.4931" 320 | }, 321 | timezone: { 322 | offset: "-1:00", 323 | description: "Azores, Cape Verde Islands" 324 | } 325 | }, 326 | email: "marij.peterson@example.com", 327 | login: { 328 | uuid: "25cad49e-cddf-4e3f-ad05-2406f5736468", 329 | username: "ticklishkoala385", 330 | password: "boxers", 331 | salt: "5AxWwtzi", 332 | md5: "c48d12153a9eb95ab387de47624fa008", 333 | sha1: "e071aa71a03415e780c669330e32d0732a76cf4c", 334 | sha256: "134c85c7d12c76004f2059e44ec7b03a509ebab5d29a143a296c11bb9b0795b1" 335 | }, 336 | dob: { 337 | date: "1975-08-07T08:04:14.675Z", 338 | age: 45 339 | }, 340 | registered: { 341 | date: "2018-11-23T17:45:04.918Z", 342 | age: 2 343 | }, 344 | phone: "(599)-503-4927", 345 | cell: "(091)-870-4092", 346 | id: { 347 | name: "BSN", 348 | value: "06470101" 349 | }, 350 | picture: { 351 | large: "https://randomuser.me/api/portraits/women/15.jpg", 352 | medium: "https://randomuser.me/api/portraits/med/women/15.jpg", 353 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/15.jpg" 354 | }, 355 | nat: "NL" 356 | }, 357 | { 358 | gender: "male", 359 | name: { 360 | title: "Mr", 361 | first: "Umut", 362 | last: "Velioğlu" 363 | }, 364 | location: { 365 | street: { 366 | number: 2913, 367 | name: "Fatih Sultan Mehmet Cd" 368 | }, 369 | city: "Bingöl", 370 | state: "Ordu", 371 | country: "Turkey", 372 | postcode: 48767, 373 | coordinates: { 374 | latitude: "-38.8383", 375 | longitude: "59.4001" 376 | }, 377 | timezone: { 378 | offset: "+4:00", 379 | description: "Abu Dhabi, Muscat, Baku, Tbilisi" 380 | } 381 | }, 382 | email: "umut.velioglu@example.com", 383 | login: { 384 | uuid: "f1d62a3a-687b-4554-af54-933108e357e6", 385 | username: "beautifullion873", 386 | password: "ruth", 387 | salt: "wFqm248u", 388 | md5: "ad97e1e587cfd647b385b039dc21b8a2", 389 | sha1: "b2924c51f7210328a56537b51764f904f082652e", 390 | sha256: "41b95a98e9fc1ba7895fb2c0cb9ce1b0078f5f48becb076bfbc4c8d358a79c0d" 391 | }, 392 | dob: { 393 | date: "1977-09-26T15:06:57.700Z", 394 | age: 43 395 | }, 396 | registered: { 397 | date: "2006-09-15T10:14:55.174Z", 398 | age: 14 399 | }, 400 | phone: "(452)-398-2959", 401 | cell: "(229)-507-9942", 402 | id: { 403 | name: "", 404 | value: null 405 | }, 406 | picture: { 407 | large: "https://randomuser.me/api/portraits/men/93.jpg", 408 | medium: "https://randomuser.me/api/portraits/med/men/93.jpg", 409 | thumbnail: "https://randomuser.me/api/portraits/thumb/men/93.jpg" 410 | }, 411 | nat: "TR" 412 | }, 413 | { 414 | gender: "male", 415 | name: { 416 | title: "Mr", 417 | first: "Adrian", 418 | last: "Cole" 419 | }, 420 | location: { 421 | street: { 422 | number: 1952, 423 | name: "Adams St" 424 | }, 425 | city: "Sunshine Coast", 426 | state: "Northern Territory", 427 | country: "Australia", 428 | postcode: 1299, 429 | coordinates: { 430 | latitude: "-49.1278", 431 | longitude: "112.0345" 432 | }, 433 | timezone: { 434 | offset: "+5:00", 435 | description: "Ekaterinburg, Islamabad, Karachi, Tashkent" 436 | } 437 | }, 438 | email: "adrian.cole@example.com", 439 | login: { 440 | uuid: "b93858ea-19e4-44df-aa77-0d6311cab793", 441 | username: "browngorilla780", 442 | password: "carlitos", 443 | salt: "JAu8TB6H", 444 | md5: "799eb5447987bf49c36ac0a559714f37", 445 | sha1: "f4cbc7440b07140e2359c053431ff04b02785a29", 446 | sha256: "128f5c9b479c869415ae478f6ff9dbfdf75c70f445dc9a18652d0e09bcee2e57" 447 | }, 448 | dob: { 449 | date: "1975-07-31T18:31:24.124Z", 450 | age: 45 451 | }, 452 | registered: { 453 | date: "2003-11-30T01:17:08.314Z", 454 | age: 17 455 | }, 456 | phone: "03-3213-1236", 457 | cell: "0419-353-484", 458 | id: { 459 | name: "TFN", 460 | value: "376279632" 461 | }, 462 | picture: { 463 | large: "https://randomuser.me/api/portraits/men/7.jpg", 464 | medium: "https://randomuser.me/api/portraits/med/men/7.jpg", 465 | thumbnail: "https://randomuser.me/api/portraits/thumb/men/7.jpg" 466 | }, 467 | nat: "AU" 468 | }, 469 | { 470 | gender: "female", 471 | name: { 472 | title: "Miss", 473 | first: "Mestan", 474 | last: "Arıcan" 475 | }, 476 | location: { 477 | street: { 478 | number: 8421, 479 | name: "Şehitler Cd" 480 | }, 481 | city: "Şırnak", 482 | state: "Ardahan", 483 | country: "Turkey", 484 | postcode: 39665, 485 | coordinates: { 486 | latitude: "66.6698", 487 | longitude: "54.1801" 488 | }, 489 | timezone: { 490 | offset: "+3:00", 491 | description: "Baghdad, Riyadh, Moscow, St. Petersburg" 492 | } 493 | }, 494 | email: "mestan.arican@example.com", 495 | login: { 496 | uuid: "aefd7e3b-2558-4641-b070-f62f727ce5c7", 497 | username: "purplewolf377", 498 | password: "prozac", 499 | salt: "m26LQtq0", 500 | md5: "e8986db4f0ba8c563d643e75cbc88107", 501 | sha1: "3d43c7ff180932c1cb84ee83a13ae3143786a74e", 502 | sha256: "2810fd77102ab249a99773ab33bd2776293d3de2bf08b30551da22d00342bb99" 503 | }, 504 | dob: { 505 | date: "1994-02-19T10:45:27.820Z", 506 | age: 26 507 | }, 508 | registered: { 509 | date: "2006-03-09T07:56:49.873Z", 510 | age: 14 511 | }, 512 | phone: "(574)-886-3239", 513 | cell: "(840)-519-4713", 514 | id: { 515 | name: "", 516 | value: null 517 | }, 518 | picture: { 519 | large: "https://randomuser.me/api/portraits/women/71.jpg", 520 | medium: "https://randomuser.me/api/portraits/med/women/71.jpg", 521 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/71.jpg" 522 | }, 523 | nat: "TR" 524 | }, 525 | { 526 | gender: "female", 527 | name: { 528 | title: "Mrs", 529 | first: "Deusete", 530 | last: "Caldeira" 531 | }, 532 | location: { 533 | street: { 534 | number: 1494, 535 | name: "Rua Santa Luzia " 536 | }, 537 | city: "São José do Rio Preto", 538 | state: "Distrito Federal", 539 | country: "Brazil", 540 | postcode: 83098, 541 | coordinates: { 542 | latitude: "63.8309", 543 | longitude: "170.6055" 544 | }, 545 | timezone: { 546 | offset: "+9:30", 547 | description: "Adelaide, Darwin" 548 | } 549 | }, 550 | email: "deusete.caldeira@example.com", 551 | login: { 552 | uuid: "2a60d53c-24f2-4409-9990-2f5fd55d14eb", 553 | username: "angrycat717", 554 | password: "bluejays", 555 | salt: "A4reDxmY", 556 | md5: "2b83d5d691b5c035b227cbcc494cae8b", 557 | sha1: "5158659ae853a6739318e9745d5bdfe8b35cbdd4", 558 | sha256: "bde41865208479fe882d4df24758aa26eb615319893f1cc9b0e8575833b8644e" 559 | }, 560 | dob: { 561 | date: "1946-08-31T19:31:38.838Z", 562 | age: 74 563 | }, 564 | registered: { 565 | date: "2006-11-09T14:25:17.403Z", 566 | age: 14 567 | }, 568 | phone: "(57) 3559-0154", 569 | cell: "(87) 3485-7986", 570 | id: { 571 | name: "", 572 | value: null 573 | }, 574 | picture: { 575 | large: "https://randomuser.me/api/portraits/women/57.jpg", 576 | medium: "https://randomuser.me/api/portraits/med/women/57.jpg", 577 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/57.jpg" 578 | }, 579 | nat: "BR" 580 | } 581 | ]; 582 | 583 | // Array find 584 | const correoe = "umut.velioglu@example.com"; 585 | const usuarioSeleccionado = users.find(user => user.email === correoe); 586 | 587 | // Array findIndex 588 | const uuid = "2a60d53c-24f2-4409-9990-2f5fd55d14eb"; 589 | const indiceSeleccionado = users.findIndex(user => user.login.uuid === uuid); 590 | users.splice(indiceSeleccionado, 1); 591 | 592 | // Array filter 593 | const usuariosFemeninos = users.filter(user => (user.gender = "female")); 594 | 595 | // Array includes 596 | console.log(Array.of(1, 2, 3, 4, 5, 6).includes(7)); 597 | 598 | if (usuarioSeleccionado.email.includes("@")) { 599 | console.log("Correo correcto"); 600 | } 601 | -------------------------------------------------------------------------------- /10-mejores-matrices/users.js: -------------------------------------------------------------------------------- 1 | const users = [ 2 | { 3 | gender: "female", 4 | name: { 5 | title: "Miss", 6 | first: "Asta", 7 | last: "Christiansen" 8 | }, 9 | location: { 10 | street: { 11 | number: 5081, 12 | name: "Sneppevej" 13 | }, 14 | city: "Nykøbing F", 15 | state: "Nordjylland", 16 | country: "Denmark", 17 | postcode: 12136, 18 | coordinates: { 19 | latitude: "-29.0201", 20 | longitude: "103.6408" 21 | }, 22 | timezone: { 23 | offset: "+5:00", 24 | description: "Ekaterinburg, Islamabad, Karachi, Tashkent" 25 | } 26 | }, 27 | email: "asta.christiansen@example.com", 28 | login: { 29 | uuid: "123a8c89-0758-4e6e-ae86-03929aa3a418", 30 | username: "happybear273", 31 | password: "limited", 32 | salt: "BvH6A6k6", 33 | md5: "aa77bc3647797908f0523f4ea95ce3fc", 34 | sha1: "0c464db89208967214c6610af7fbce992eccd077", 35 | sha256: "757f48a3508ae70b1456360eff00ee5ac1b2338d0d9196b155dabc4ff0614e24" 36 | }, 37 | dob: { 38 | date: "1976-10-12T06:59:24.554Z", 39 | age: 44 40 | }, 41 | registered: { 42 | date: "2005-01-04T05:53:07.165Z", 43 | age: 15 44 | }, 45 | phone: "66162155", 46 | cell: "87233770", 47 | id: { 48 | name: "CPR", 49 | value: "121076-7844" 50 | }, 51 | picture: { 52 | large: "https://randomuser.me/api/portraits/women/59.jpg", 53 | medium: "https://randomuser.me/api/portraits/med/women/59.jpg", 54 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/59.jpg" 55 | }, 56 | nat: "DK" 57 | }, 58 | { 59 | gender: "female", 60 | name: { 61 | title: "Mrs", 62 | first: "Karen", 63 | last: "Nichols" 64 | }, 65 | location: { 66 | street: { 67 | number: 9621, 68 | name: "St. John’S Road" 69 | }, 70 | city: "Kingston upon Hull", 71 | state: "Dyfed", 72 | country: "United Kingdom", 73 | postcode: "C84 1SF", 74 | coordinates: { 75 | latitude: "16.8810", 76 | longitude: "108.3179" 77 | }, 78 | timezone: { 79 | offset: "+3:00", 80 | description: "Baghdad, Riyadh, Moscow, St. Petersburg" 81 | } 82 | }, 83 | email: "karen.nichols@example.com", 84 | login: { 85 | uuid: "c346cc1b-e778-498a-98fc-6512f7962680", 86 | username: "greendog231", 87 | password: "81fukkc", 88 | salt: "j7EMykAI", 89 | md5: "7dd459db43dd0ee8675413c1e48680cf", 90 | sha1: "958daf4f551b79abade562150c6f81e6a03be189", 91 | sha256: "882654da43d51ae0f53a2c9a4b28eb4fbc43607477bd1e6c594d028dbcdda5a4" 92 | }, 93 | dob: { 94 | date: "1998-02-17T07:32:30.798Z", 95 | age: 22 96 | }, 97 | registered: { 98 | date: "2004-01-02T03:38:48.757Z", 99 | age: 16 100 | }, 101 | phone: "022 5978 8992", 102 | cell: "0738-031-204", 103 | id: { 104 | name: "NINO", 105 | value: "MY 42 87 52 N" 106 | }, 107 | picture: { 108 | large: "https://randomuser.me/api/portraits/women/80.jpg", 109 | medium: "https://randomuser.me/api/portraits/med/women/80.jpg", 110 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/80.jpg" 111 | }, 112 | nat: "GB" 113 | }, 114 | { 115 | gender: "female", 116 | name: { 117 | title: "Miss", 118 | first: "Sofia", 119 | last: "Olsen" 120 | }, 121 | location: { 122 | street: { 123 | number: 8983, 124 | name: "Hirsevænget" 125 | }, 126 | city: "Gørløse", 127 | state: "Syddanmark", 128 | country: "Denmark", 129 | postcode: 94453, 130 | coordinates: { 131 | latitude: "-20.1172", 132 | longitude: "-119.1971" 133 | }, 134 | timezone: { 135 | offset: "+4:00", 136 | description: "Abu Dhabi, Muscat, Baku, Tbilisi" 137 | } 138 | }, 139 | email: "sofia.olsen@example.com", 140 | login: { 141 | uuid: "2f1d0134-b33b-47bd-9a09-b144d9f37224", 142 | username: "bigrabbit664", 143 | password: "ariana", 144 | salt: "MPECa1zp", 145 | md5: "e9ec25ca598c68afa36fe24e4f9c0db9", 146 | sha1: "868308c4736e2b2bf3c85576eabb6907e4d6aba4", 147 | sha256: "6f4c583915ce02c4a523358e22d8613785f5744ce02a6e4efcca4e8b2645a0c6" 148 | }, 149 | dob: { 150 | date: "1982-04-08T00:08:31.952Z", 151 | age: 38 152 | }, 153 | registered: { 154 | date: "2010-10-26T08:06:42.483Z", 155 | age: 10 156 | }, 157 | phone: "28669984", 158 | cell: "82713354", 159 | id: { 160 | name: "CPR", 161 | value: "080482-2160" 162 | }, 163 | picture: { 164 | large: "https://randomuser.me/api/portraits/women/56.jpg", 165 | medium: "https://randomuser.me/api/portraits/med/women/56.jpg", 166 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/56.jpg" 167 | }, 168 | nat: "DK" 169 | }, 170 | { 171 | gender: "male", 172 | name: { 173 | title: "Mr", 174 | first: "Väinö", 175 | last: "Kotila" 176 | }, 177 | location: { 178 | street: { 179 | number: 9380, 180 | name: "Nordenskiöldinkatu" 181 | }, 182 | city: "Hyvinkää", 183 | state: "Ostrobothnia", 184 | country: "Finland", 185 | postcode: 79560, 186 | coordinates: { 187 | latitude: "56.6816", 188 | longitude: "-13.8552" 189 | }, 190 | timezone: { 191 | offset: "-8:00", 192 | description: "Pacific Time (US & Canada)" 193 | } 194 | }, 195 | email: "vaino.kotila@example.com", 196 | login: { 197 | uuid: "b01c06d9-6ed1-4c50-96b7-1dfde3fbebc0", 198 | username: "angryswan427", 199 | password: "hillbill", 200 | salt: "5vXD19jP", 201 | md5: "5683923eb4140a7a1615c9636e7c2d59", 202 | sha1: "563c59a08a563423b4d1746350b569ee5391459e", 203 | sha256: "f36fdf23206d7a42e1189c3c014c9f3c92838fed9a35bab620d03897e87d082d" 204 | }, 205 | dob: { 206 | date: "1956-02-29T21:28:45.826Z", 207 | age: 64 208 | }, 209 | registered: { 210 | date: "2016-04-09T12:12:51.136Z", 211 | age: 4 212 | }, 213 | phone: "04-913-065", 214 | cell: "045-501-93-98", 215 | id: { 216 | name: "HETU", 217 | value: "NaNNA339undefined" 218 | }, 219 | picture: { 220 | large: "https://randomuser.me/api/portraits/men/18.jpg", 221 | medium: "https://randomuser.me/api/portraits/med/men/18.jpg", 222 | thumbnail: "https://randomuser.me/api/portraits/thumb/men/18.jpg" 223 | }, 224 | nat: "FI" 225 | }, 226 | { 227 | gender: "male", 228 | name: { 229 | title: "Mr", 230 | first: "Thomas", 231 | last: "Park" 232 | }, 233 | location: { 234 | street: { 235 | number: 1581, 236 | name: "Frederick Ave" 237 | }, 238 | city: "Chipman", 239 | state: "Nova Scotia", 240 | country: "Canada", 241 | postcode: "U7K 2I0", 242 | coordinates: { 243 | latitude: "50.3530", 244 | longitude: "1.9533" 245 | }, 246 | timezone: { 247 | offset: "-5:00", 248 | description: "Eastern Time (US & Canada), Bogota, Lima" 249 | } 250 | }, 251 | email: "thomas.park@example.com", 252 | login: { 253 | uuid: "102104c7-6ac1-469a-b2ca-1fdfe2a3e749", 254 | username: "redleopard528", 255 | password: "reading", 256 | salt: "jaGgkj8C", 257 | md5: "b5f51d91325ca10367216cc5b5f58fc6", 258 | sha1: "d8c49a615bc890972d8e846a190c0cc5f6aba6d5", 259 | sha256: "99b083186f5c23072a6a12695db22f51b7b548e756bb22ccd5b6a7a259240b01" 260 | }, 261 | dob: { 262 | date: "1985-05-08T09:09:24.055Z", 263 | age: 35 264 | }, 265 | registered: { 266 | date: "2002-06-28T14:55:55.350Z", 267 | age: 18 268 | }, 269 | phone: "351-536-7569", 270 | cell: "608-857-4982", 271 | id: { 272 | name: "", 273 | value: null 274 | }, 275 | picture: { 276 | large: "https://randomuser.me/api/portraits/men/56.jpg", 277 | medium: "https://randomuser.me/api/portraits/med/men/56.jpg", 278 | thumbnail: "https://randomuser.me/api/portraits/thumb/men/56.jpg" 279 | }, 280 | nat: "CA" 281 | }, 282 | { 283 | gender: "female", 284 | name: { 285 | title: "Ms", 286 | first: "Marij", 287 | last: "Peterson" 288 | }, 289 | location: { 290 | street: { 291 | number: 9752, 292 | name: "Bergumermeerstraat" 293 | }, 294 | city: "Elsendorp", 295 | state: "Utrecht", 296 | country: "Netherlands", 297 | postcode: 94928, 298 | coordinates: { 299 | latitude: "-14.4505", 300 | longitude: "-131.4931" 301 | }, 302 | timezone: { 303 | offset: "-1:00", 304 | description: "Azores, Cape Verde Islands" 305 | } 306 | }, 307 | email: "marij.peterson@example.com", 308 | login: { 309 | uuid: "25cad49e-cddf-4e3f-ad05-2406f5736468", 310 | username: "ticklishkoala385", 311 | password: "boxers", 312 | salt: "5AxWwtzi", 313 | md5: "c48d12153a9eb95ab387de47624fa008", 314 | sha1: "e071aa71a03415e780c669330e32d0732a76cf4c", 315 | sha256: "134c85c7d12c76004f2059e44ec7b03a509ebab5d29a143a296c11bb9b0795b1" 316 | }, 317 | dob: { 318 | date: "1975-08-07T08:04:14.675Z", 319 | age: 45 320 | }, 321 | registered: { 322 | date: "2018-11-23T17:45:04.918Z", 323 | age: 2 324 | }, 325 | phone: "(599)-503-4927", 326 | cell: "(091)-870-4092", 327 | id: { 328 | name: "BSN", 329 | value: "06470101" 330 | }, 331 | picture: { 332 | large: "https://randomuser.me/api/portraits/women/15.jpg", 333 | medium: "https://randomuser.me/api/portraits/med/women/15.jpg", 334 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/15.jpg" 335 | }, 336 | nat: "NL" 337 | }, 338 | { 339 | gender: "male", 340 | name: { 341 | title: "Mr", 342 | first: "Umut", 343 | last: "Velioğlu" 344 | }, 345 | location: { 346 | street: { 347 | number: 2913, 348 | name: "Fatih Sultan Mehmet Cd" 349 | }, 350 | city: "Bingöl", 351 | state: "Ordu", 352 | country: "Turkey", 353 | postcode: 48767, 354 | coordinates: { 355 | latitude: "-38.8383", 356 | longitude: "59.4001" 357 | }, 358 | timezone: { 359 | offset: "+4:00", 360 | description: "Abu Dhabi, Muscat, Baku, Tbilisi" 361 | } 362 | }, 363 | email: "umut.velioglu@example.com", 364 | login: { 365 | uuid: "f1d62a3a-687b-4554-af54-933108e357e6", 366 | username: "beautifullion873", 367 | password: "ruth", 368 | salt: "wFqm248u", 369 | md5: "ad97e1e587cfd647b385b039dc21b8a2", 370 | sha1: "b2924c51f7210328a56537b51764f904f082652e", 371 | sha256: "41b95a98e9fc1ba7895fb2c0cb9ce1b0078f5f48becb076bfbc4c8d358a79c0d" 372 | }, 373 | dob: { 374 | date: "1977-09-26T15:06:57.700Z", 375 | age: 43 376 | }, 377 | registered: { 378 | date: "2006-09-15T10:14:55.174Z", 379 | age: 14 380 | }, 381 | phone: "(452)-398-2959", 382 | cell: "(229)-507-9942", 383 | id: { 384 | name: "", 385 | value: null 386 | }, 387 | picture: { 388 | large: "https://randomuser.me/api/portraits/men/93.jpg", 389 | medium: "https://randomuser.me/api/portraits/med/men/93.jpg", 390 | thumbnail: "https://randomuser.me/api/portraits/thumb/men/93.jpg" 391 | }, 392 | nat: "TR" 393 | }, 394 | { 395 | gender: "male", 396 | name: { 397 | title: "Mr", 398 | first: "Adrian", 399 | last: "Cole" 400 | }, 401 | location: { 402 | street: { 403 | number: 1952, 404 | name: "Adams St" 405 | }, 406 | city: "Sunshine Coast", 407 | state: "Northern Territory", 408 | country: "Australia", 409 | postcode: 1299, 410 | coordinates: { 411 | latitude: "-49.1278", 412 | longitude: "112.0345" 413 | }, 414 | timezone: { 415 | offset: "+5:00", 416 | description: "Ekaterinburg, Islamabad, Karachi, Tashkent" 417 | } 418 | }, 419 | email: "adrian.cole@example.com", 420 | login: { 421 | uuid: "b93858ea-19e4-44df-aa77-0d6311cab793", 422 | username: "browngorilla780", 423 | password: "carlitos", 424 | salt: "JAu8TB6H", 425 | md5: "799eb5447987bf49c36ac0a559714f37", 426 | sha1: "f4cbc7440b07140e2359c053431ff04b02785a29", 427 | sha256: "128f5c9b479c869415ae478f6ff9dbfdf75c70f445dc9a18652d0e09bcee2e57" 428 | }, 429 | dob: { 430 | date: "1975-07-31T18:31:24.124Z", 431 | age: 45 432 | }, 433 | registered: { 434 | date: "2003-11-30T01:17:08.314Z", 435 | age: 17 436 | }, 437 | phone: "03-3213-1236", 438 | cell: "0419-353-484", 439 | id: { 440 | name: "TFN", 441 | value: "376279632" 442 | }, 443 | picture: { 444 | large: "https://randomuser.me/api/portraits/men/7.jpg", 445 | medium: "https://randomuser.me/api/portraits/med/men/7.jpg", 446 | thumbnail: "https://randomuser.me/api/portraits/thumb/men/7.jpg" 447 | }, 448 | nat: "AU" 449 | }, 450 | { 451 | gender: "female", 452 | name: { 453 | title: "Miss", 454 | first: "Mestan", 455 | last: "Arıcan" 456 | }, 457 | location: { 458 | street: { 459 | number: 8421, 460 | name: "Şehitler Cd" 461 | }, 462 | city: "Şırnak", 463 | state: "Ardahan", 464 | country: "Turkey", 465 | postcode: 39665, 466 | coordinates: { 467 | latitude: "66.6698", 468 | longitude: "54.1801" 469 | }, 470 | timezone: { 471 | offset: "+3:00", 472 | description: "Baghdad, Riyadh, Moscow, St. Petersburg" 473 | } 474 | }, 475 | email: "mestan.arican@example.com", 476 | login: { 477 | uuid: "aefd7e3b-2558-4641-b070-f62f727ce5c7", 478 | username: "purplewolf377", 479 | password: "prozac", 480 | salt: "m26LQtq0", 481 | md5: "e8986db4f0ba8c563d643e75cbc88107", 482 | sha1: "3d43c7ff180932c1cb84ee83a13ae3143786a74e", 483 | sha256: "2810fd77102ab249a99773ab33bd2776293d3de2bf08b30551da22d00342bb99" 484 | }, 485 | dob: { 486 | date: "1994-02-19T10:45:27.820Z", 487 | age: 26 488 | }, 489 | registered: { 490 | date: "2006-03-09T07:56:49.873Z", 491 | age: 14 492 | }, 493 | phone: "(574)-886-3239", 494 | cell: "(840)-519-4713", 495 | id: { 496 | name: "", 497 | value: null 498 | }, 499 | picture: { 500 | large: "https://randomuser.me/api/portraits/women/71.jpg", 501 | medium: "https://randomuser.me/api/portraits/med/women/71.jpg", 502 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/71.jpg" 503 | }, 504 | nat: "TR" 505 | }, 506 | { 507 | gender: "female", 508 | name: { 509 | title: "Mrs", 510 | first: "Deusete", 511 | last: "Caldeira" 512 | }, 513 | location: { 514 | street: { 515 | number: 1494, 516 | name: "Rua Santa Luzia " 517 | }, 518 | city: "São José do Rio Preto", 519 | state: "Distrito Federal", 520 | country: "Brazil", 521 | postcode: 83098, 522 | coordinates: { 523 | latitude: "63.8309", 524 | longitude: "170.6055" 525 | }, 526 | timezone: { 527 | offset: "+9:30", 528 | description: "Adelaide, Darwin" 529 | } 530 | }, 531 | email: "deusete.caldeira@example.com", 532 | login: { 533 | uuid: "2a60d53c-24f2-4409-9990-2f5fd55d14eb", 534 | username: "angrycat717", 535 | password: "bluejays", 536 | salt: "A4reDxmY", 537 | md5: "2b83d5d691b5c035b227cbcc494cae8b", 538 | sha1: "5158659ae853a6739318e9745d5bdfe8b35cbdd4", 539 | sha256: "bde41865208479fe882d4df24758aa26eb615319893f1cc9b0e8575833b8644e" 540 | }, 541 | dob: { 542 | date: "1946-08-31T19:31:38.838Z", 543 | age: 74 544 | }, 545 | registered: { 546 | date: "2006-11-09T14:25:17.403Z", 547 | age: 14 548 | }, 549 | phone: "(57) 3559-0154", 550 | cell: "(87) 3485-7986", 551 | id: { 552 | name: "", 553 | value: null 554 | }, 555 | picture: { 556 | large: "https://randomuser.me/api/portraits/women/57.jpg", 557 | medium: "https://randomuser.me/api/portraits/med/women/57.jpg", 558 | thumbnail: "https://randomuser.me/api/portraits/thumb/women/57.jpg" 559 | }, 560 | nat: "BR" 561 | } 562 | ]; 563 | -------------------------------------------------------------------------------- /11-parametros-defecto/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JS 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /11-parametros-defecto/parametros-defecto.js: -------------------------------------------------------------------------------- 1 | function randomNum() { 2 | return Math.floor(Math.random() * 2) + 1; 3 | } 4 | 5 | function sumar(num1 = 1, num2 = randomNum()) { 6 | // var num1 = 1; 7 | // var num2 = undefined; 8 | 9 | // if (!num1 || !num2) return; 10 | // !num1 && (num1 = 1); 11 | // !num2 && (num2 = 3); 12 | return num1 + num2; 13 | } 14 | 15 | console.log(sumar(undefined, 5)); 16 | -------------------------------------------------------------------------------- /12-mejores-numeros/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JS 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /12-mejores-numeros/mejores-numeros.js: -------------------------------------------------------------------------------- 1 | // Math.trunc 2 | // Convierte a número antes de comparar 3 | const num = 123.345; 4 | console.log(Math.trunc(num)); 5 | // console.log(Math.ceil(num)); 6 | // const num2 = 1312312312312312312312.1; 7 | // console.log(num2.toString()); 8 | // console.log(parseInt(num2)); 9 | 10 | // Number.isNaN 11 | let valor = undefined + 1; 12 | console.log(Number.isNaN(valor)); 13 | // El método global retorna true en valores que se pueden convertir en NaN pero que no tienen por qué ser NaN. Ojo con esto. 14 | // console.log(isNaN(valor)); 15 | 16 | // valor = "NaN"; 17 | // console.log(Number.isNaN(valor)); 18 | // console.log(isNaN(valor)); 19 | 20 | // Number.isInteger 21 | let entero = 10; 22 | console.log(Number.isInteger(entero)); 23 | 24 | // entero = 10.0; 25 | // console.log(Number.isInteger(entero)); 26 | 27 | // entero = 10.234; 28 | // console.log(Number.isInteger(entero)); // false 29 | 30 | // Number.isFinite 31 | let finito = 20; 32 | console.log(Number.isFinite(finito)); 33 | // El método global convierte a número 34 | // console.log(isFinite(finito)); 35 | 36 | // finito = "20"; 37 | // console.log(Number.isFinite(finito)); 38 | // console.log(isFinite(finito)); 39 | -------------------------------------------------------------------------------- /13-sets/sets.js: -------------------------------------------------------------------------------- 1 | const myColors = ["purple", "cyan"]; 2 | const colors = new Set(myColors); 3 | 4 | // Añadir al set 5 | colors.add("red"); 6 | colors.add("green"); 7 | colors.add("white"); 8 | colors.add("yellow"); 9 | // No permite duplicados 10 | colors.add("yellow"); 11 | colors.add("yellow"); 12 | colors.add("yellow"); 13 | colors.add("yellow"); 14 | 15 | // Iterar sobre el set 16 | for (let color of colors) { 17 | console.log(color); 18 | } 19 | 20 | // Eliminar elementos del set 21 | console.log(colors.size); 22 | console.log(colors.delete("yellow")); 23 | console.log(colors.size); 24 | 25 | const text = "Welcome to the jungle!"; 26 | console.log(text.length); 27 | console.log(new Set(text).values()); 28 | 29 | // Acceder a elementos del set 30 | console.log(colors.has("green")); 31 | 32 | // Limpiar el set 33 | colors.clear(); 34 | -------------------------------------------------------------------------------- /13-sets/test.js: -------------------------------------------------------------------------------- 1 | // Mini ejercicio 2 | const users = ["Juan", "Alberto", "Raúl", "María", "Laura", "Elena", "Guizmo"]; 3 | const userVisits = new Set(); 4 | 5 | function visit() { 6 | const userIndex = Math.floor(Math.random() * users.length); 7 | const user = users[userIndex]; 8 | userVisits.has(user) && 9 | console.warn(`User ${user} already visited the page!`); 10 | userVisits.add(user); 11 | console.log(userVisits); 12 | 13 | if (userVisits.size === users.length) { 14 | console.info("All users have visited the page!"); 15 | clearInterval(interval); 16 | userVisits.clear(); 17 | } 18 | } 19 | 20 | const interval = setInterval(visit, 300); 21 | -------------------------------------------------------------------------------- /14-maps/maps.js: -------------------------------------------------------------------------------- 1 | const map = new Map() 2 | 3 | map.set(1, "Number"); 4 | map.set("1", "String"); 5 | map.set(true, "Boolean"); 6 | 7 | console.log(map.get(1)) 8 | 9 | console.log(typeof(map)); 10 | console.log(map instanceof Map); 11 | 12 | //for (let key of map.keys()) { 13 | // console.log(key) 14 | //} 15 | // 16 | //for (let val of map.values()) { 17 | // console.log(val) 18 | //} 19 | // 20 | //for (let data of map.entries()) { 21 | // let [key, value] = data; 22 | // console.log(key, value); 23 | //} 24 | 25 | const person = { 26 | name: "Juan", 27 | city: "Valencia", 28 | color: "red" 29 | } 30 | 31 | const personMap = new Map(Object.entries(person)); 32 | //console.log(personMap.get("city")) 33 | 34 | const personClone = Object.fromEntries(personMap); 35 | 36 | let juan = {name: 'Juan'}, nino ={name: 'Nino'}, guizmo ={name: 'Guizmo'}; 37 | 38 | let otro = {name: 'Otro'} 39 | 40 | const admins = new Map() 41 | 42 | admins 43 | .set(juan, 'superadmin') 44 | .set(nino, 'admin') 45 | .set(guizmo, 'editor') 46 | 47 | function doAdmin(user) { 48 | if (admins.has(user)) { 49 | console.info(`User ${user.name} is doing ${admins.get(user)} stuff!`) 50 | } else { 51 | console.error("User not found on admin list!") 52 | } 53 | } 54 | 55 | juan = null; 56 | doAdmin(juan); -------------------------------------------------------------------------------- /15-mejores-strings/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JS 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /15-mejores-strings/mejores-strings.js: -------------------------------------------------------------------------------- 1 | const hi = "Hello world"; 2 | const from = "from Spain"; 3 | //const final = hi + from; 4 | 5 | function day() { 6 | return "friday"; 7 | } 8 | 9 | // Usando template strings 10 | const final = `${hi} ${from} on ${day()}`; 11 | 12 | const multiline = `Hello 13 | World`; 14 | 15 | // Includes 16 | const email = "hola@wmedia.es"; 17 | // if (email.includes("@")) console.log("Valid email"); 18 | 19 | // StartsWith / EndsWith 20 | // if (email.endsWith("wmedia.es")) console.log("Valid email"); 21 | 22 | const validEmail = email => email.includes("@") && email.endsWith("wmedia.es"); 23 | if (validEmail(email)) console.log("Valid email"); 24 | 25 | // Tagged templates 26 | const cat = { 27 | name: "Guizmo", 28 | color: "black", 29 | image: 30 | "https://www.guideposts.org/sites/guideposts.org/files/styles/bynder_webimage/public/story/blackcat_marquee_0.jpg", 31 | city: "Valencia" 32 | }; 33 | 34 | function makeTemplate(strings, ...keys) { 35 | console.log(strings, keys); 36 | return function(data) { 37 | console.log(data); 38 | let slices = strings.slice(); 39 | keys.forEach(function(key, index) { 40 | slices[index] += data[key]; 41 | }); 42 | return slices.join(""); 43 | }; 44 | } 45 | 46 | const catTemplate = makeTemplate` 47 |
48 |

${"name"}

49 |

${"color"} from ${"city"}

50 | 51 |
52 | `(cat); 53 | 54 | const catElement = document.createElement("div"); 55 | catElement.innerHTML = catTemplate; 56 | document.body.appendChild(catElement); 57 | -------------------------------------------------------------------------------- /16-arrow-functions/arrow-functions.js: -------------------------------------------------------------------------------- 1 | // Función declarada 2 | function sayHi1(name) { 3 | console.log(`Hi ${name}`); 4 | } 5 | 6 | // Expresión funcional 7 | const sayHi2 = function(name) { 8 | console.log(`Hi ${name}`); 9 | } 10 | 11 | // Funciones flecha (arrow functions) 12 | const sayHi3 = name => console.log(`Hi ${name}`); 13 | 14 | // Return implícito 15 | const double = num => num * 2; 16 | 17 | // Return explícito 18 | const quadruple = num => { 19 | let value = double(num) 20 | return value * 2 21 | } 22 | 23 | const num = quadruple(2) 24 | 25 | // Arrow functions no tienen this 26 | const cat = { 27 | name: "Guizmo", 28 | tags: ["fucking", "amazing", "black", "cat", "😼"], 29 | showTags() { 30 | this.tags.forEach(tag => console.log(tag)) 31 | // this.tags.forEach(function(tag) { 32 | // console.log(this === cat) 33 | // }) 34 | } 35 | }; 36 | 37 | cat.showTags() -------------------------------------------------------------------------------- /17-nuevas-variables/nuevas-variables.js: -------------------------------------------------------------------------------- 1 | // var crea variables con ámbito global/funcional 2 | var name = "Andrés" 3 | 4 | function greetings() { 5 | var name = undefined 6 | 7 | return function() { 8 | // Closure 9 | console.log(name) 10 | } 11 | 12 | name = "Juan" 13 | 14 | } 15 | 16 | //greetings()() 17 | 18 | // let crea variables con ámbito de bloque 19 | //var i = 1; 20 | //for (i; i <= 10; i++) { 21 | // console.log(i) 22 | //} 23 | 24 | for (let i = 1; i <= 10; i++) { 25 | //console.log(i) 26 | } 27 | 28 | // console.log(i) // Ya no tenemos acceso 29 | 30 | if (true) { 31 | let transform = name.toUpperCase(); 32 | } 33 | 34 | // console.log(transform) // No tenemos acceso 35 | 36 | // const crea constantes 37 | const IVA = .21 38 | // IVA = .16 // No se puede cambiar 39 | 40 | const Person = {} 41 | Person.name = name 42 | console.log(Person) // No hay problema 43 | 44 | const Person2 = Person 45 | Person2.city = "Valencia" 46 | console.log(Person) --------------------------------------------------------------------------------