elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


  Mostrar Mensajes
Páginas: [1]
1  Programación / Desarrollo Web / Re: Comparar Fechas en: 16 Septiembre 2017, 22:56 pm
con que lo resto, solo tengo fechas y que mas? no se que dos partes parseadas. Gracias por tu tiempo jeje
2  Programación / Desarrollo Web / Re: Comparar Fechas en: 16 Septiembre 2017, 22:42 pm
Claro yo ya había probado sort, pero como que no se mucho como usarlo esto es lo que había hecho
Código
  1. for (i = 0; i < artistas.length; i++) {
  2.            var gender = artistas[i].gender;
  3.            var birthday = artistas[i].birthday;
  4.            var fechas = [Date.parse(birthday)];
  5.            var nombre = artistas[i].name;
  6.            var menos10 = fechas.sort(function(a, b) {
  7.                return b - a;
  8.            }).slice(0, 10);
  9.            if (gender == 1) {
  10.  
  11.                console.log(menos10 + " :" + nombre);
  12.  
  13.            }
  14.  
  15.  
  16.        }
  17.    </scrip

pero no veo los 10 veo mas y no entiendo
3  Programación / Desarrollo Web / Re: Comparar Fechas en: 16 Septiembre 2017, 22:22 pm
Ya lo hice, me da el nombre del artista femenino mas el valor en date.parse, ahora como hago para que me traiga las 10 mas jóvenes??

Código
  1. for (i = 0; i < artistas.length; i++) {
  2.            var gender = artistas[i].gender;
  3.            var birthday = artistas[i].birthday;
  4.            var fechas = [Date.parse(birthday)];
  5.            var nombre = artistas[i].name;
  6.            if (gender == 1) {
  7.  
  8.                console.log(fechas + " :" + nombre);
  9.  
  10.            }
  11.  
  12.  
  13.        }
gracias de nuevo
4  Programación / Desarrollo Web / Re: Comparar Fechas en: 16 Septiembre 2017, 22:04 pm
me salta NaN pero si en consola pongo birthday solo me tira una fecha, no creo que sea tan dificil, solo no me estoy dando cuenta que hacer




Código
  1. var fechas = [Date.parse(birthday)];
  2.        for (i = 0; i < artistas.length; i++) {
  3.            var gender = artistas[i].gender;
  4.            var birthday = artistas[i].birthday;
  5.            var nombre = artistas[i].name;
  6.            if (gender == 1) {;
  7.                console.log(fechas);
  8.  
  9.            }
5  Programación / Desarrollo Web / Re: Comparar Fechas en: 16 Septiembre 2017, 21:25 pm
Si, pero no se muy bien como hacerlo jaja
6  Programación / Desarrollo Web / Comparar Fechas en: 16 Septiembre 2017, 21:15 pm
Hola, a todos, estoy haciendo una pagina web y necesito hacer con javascript que me diga un listado de los 10 actores femeninos de menor edad
aquí en el codigo hago que me traiga el nombre del actor femenino y su año de nacimiento, pero no se como hacer para que me diga cual es menor
obviamente la variable artistas en mucho mas larga, pero no voy a ponerles 100 artistas acá jeje


Código
  1. var artistas = [{
  2.                "birthday": "1969-08-28",
  3.                "deathday": null,
  4.                "id": 70851,
  5.                "name": "Jack Black",
  6.                "also_known_as": ["Thomas Jacob Black"],
  7.                "gender": 2,
  8.                "popularity": 7.018596,
  9.                "place_of_birth": "Santa Monica, California, USA",
  10.                "profile_path": "\/kAyKg3rYGgIhB5KRaIWALuf78W3.jpg",
  11.                "adult": false,
  12.                "imdb_id": "nm0085312",
  13.                "homepage": null
  14.            },
  15.  
  16. {
  17.                "birthday": "1990-08-15",
  18.                "deathday": null,
  19.                "id": 72129,
  20.                "name": "Jennifer Lawrence",
  21.                "also_known_as": ["Jennifer Shrader Lawrence"],
  22.                "gender": 1,
  23.                "popularity": 15.156473,
  24.                "place_of_birth": "Indian Hills, Kentucky, USA",
  25.                "profile_path": "\/naZyy9IqAQDaAbr1kYShLdg6aPR.jpg",
  26.                "adult": false,
  27.                "imdb_id": "nm2225369",
  28.                "homepage": "http:\/\/jenniferlawrencefoundation.com\/"
  29.            },
  30.  
  31.            {
  32.                "birthday": "2004-01-12",
  33.                "deathday": null,
  34.                "id": 1304602,
  35.                "name": "Ahn Seo-hyun ",
  36.                "gender": 1,
  37.                "biography": "Ahn Seo-hyun (&#50504;&#49436;&#54788;) is a South Korean actress.",
  38.                "popularity": 0.737586,
  39.                "profile_path": "\/6clumbtJbR8cOEakvsJ3tyExGj7.jpg",
  40.                "adult": false,
  41.                "imdb_id": "nm3673821",
  42.                "homepage": null
  43.            },
  44.  
  45.            {
  46.                "birthday": "1986-06-11",
  47.                "deathday": null,
  48.                "id": 10959,
  49.                "name": "Shia LaBeouf",
  50.                "also_known_as": ["Shia LeBouef", "Shia Saide LaBeouf", "Shia La Beouf",
  51.                    "Shea LaBeouf", "Shia LaBuff"
  52.                ],
  53.                "gender": 2,
  54.                "place_of_birth": "Los Angeles, California, USA ",
  55.                "profile_path": "\/anP0tygzniIok6L3OxcSZ9TYCF3.jpg",
  56.                "adult": false,
  57.                "imdb_id": "nm0479471",
  58.                "homepage": null
  59.            },
  60.  
  61.            {
  62.                "birthday": "1962-10-26",
  63.                "deathday": null,
  64.                "id": 2130,
  65.                "name": "Cary Elwes",
  66.                "also_known_as": [" Ivan Simon Cary Elwes "],
  67.                "gender": 2,
  68.                "popularity": 1.659178,
  69.                "place_of_birth": "London - England - UK",
  70.                "profile_path": "\/wmvYoJHStQeQzrpqOM9tkvf1wwF.jpg",
  71.                "adult": false,
  72.                "imdb_id": "nm0000144",
  73.                "homepage": null
  74.            },
  75.  
  76.            {
  77.                "birthday": "1980-05-19",
  78.                "deathday": null,
  79.                "id": 1237617,
  80.                "name": "Chris Jarvis",
  81.                "also_known_as": [],
  82.                "gender": 0,
  83.                "place_of_birth": "Poole - Dorset - England - UK",
  84.                "profile_path": "\/qKnRPTMNu3OCllA6MRIcvf79VJl.jpg",
  85.                "adult": false,
  86.                "imdb_id": "nm1587983",
  87.                "homepage": null
  88.            },
  89.  
  90.            {
  91.                "birthday": "1973-07-03",
  92.                "deathday": null,
  93.                "id": 17178,
  94.                "name": "Patrick Wilson",
  95.                "also_known_as": [],
  96.                "gender": 2,
  97.                "popularity": 2.102733,
  98.                "place_of_birth": "Norfolk, Virginia, USA",
  99.                "profile_path": "\/djhTpbOvrfdDsWZFFintj2Uv47a.jpg",
  100.                "adult": false,
  101.                "imdb_id": "nm0933940",
  102.                "homepage": null
  103.            },
  104.  
  105.            {
  106.                "birthday": "1977-04-02",
  107.                "deathday": null,
  108.                "id": 17288,
  109.                "name": "Michael Fassbender",
  110.                "also_known_as": [],
  111.                "gender": 2,
  112.                "popularity": 12.201965,
  113.                "place_of_birth": "Heidelberg - Baden-Württemberg - Germany",
  114.                "profile_path": "\/oexNPLumoFpazzzUqzBSDDYiUg1.jpg",
  115.                "adult": false,
  116.                "imdb_id": "nm1055413",
  117.                "homepage": null
  118.            },
  119.  
  120.            {
  121.                "birthday": "1978-02-07",
  122.                "deathday": null,
  123.                "id": 18976,
  124.                "name": "Ashton Kutcher",
  125.                "also_known_as": [],
  126.                "gender": 2,
  127.                "popularity": 2.517249,
  128.                "place_of_birth": "Cedar Rapids, Iowa, USA",
  129.                "profile_path": "\/cGEvhWHlJmSrYfkpfCtfZVeRVsP.jpg",
  130.                "adult": false,
  131.                "imdb_id": "nm0005110",
  132.                "homepage": null
  133.            },
  134.  
  135.            {
  136.                "birthday": "1968-09-25",
  137.                "deathday": null,
  138.                "id": 2888,
  139.                "name": "Will Smith",
  140.                "gender": 2,
  141.                "popularity": 12.95219,
  142.                "place_of_birth": " Philadelphia, Pennsylvania, USA",
  143.                "profile_path": "\/2iYXDlCvLyVO49louRyDDXagZ0G.jpg",
  144.                "adult": false,
  145.                "imdb_id": "nm0000226",
  146.                "homepage": "http:\/\/www.willsmith.com\/"
  147.            },
  148.  
  149.            {
  150.                "birthday": "1968-11-18",
  151.                "deathday": null,
  152.                "id": 887,
  153.                "name": "Owen Wilson",
  154.                "also_known_as": [],
  155.                "gender": 2,
  156.                "popularity": 7.032109,
  157.                "place_of_birth": "Dallas - Texas - USA",
  158.                "profile_path": "\/j7oYgvfDiO34VcFdSB7GhM2CSle.jpg",
  159.                "adult": false,
  160.                "imdb_id": "nm0005562",
  161.                "homepage": "http:\/\/wilson-brothers.com\/"
  162.            },
  163.  
  164.            {
  165.                "birthday": "1976-03-26",
  166.                "deathday": null,
  167.                "id": 20189,
  168.                "name": "Amy Smart",
  169.                "also_known_as": [],
  170.                "gender": 1,
  171.                "popularity": 9.396306,
  172.                "place_of_birth": "Topanga Canyon, California, USA",
  173.                "profile_path": "\/yTWkJVYq1wtn2NrnPIwXshTWqby.jpg",
  174.                "adult": false,
  175.                "imdb_id": "nm0005442",
  176.                "homepage": "http:\/\/www.amy-smart.com\/"
  177.            },
  178.  
  179.            {
  180.                "birthday": "1957-12-21",
  181.                "deathday": null,
  182.                "id": 15757,
  183.                "name": "Ray Romano",
  184.                "also_known_as": [],
  185.                "gender": 2,
  186.                "popularity": 3.477725,
  187.                "place_of_birth": "Queens, New York, USA",
  188.                "profile_path": "\/mB8HQPuL0DYtjjlFaU7TPKvKruJ.jpg",
  189.                "adult": false,
  190.                "imdb_id": "nm0005380",
  191.                "homepage": null
  192.            },
  193.  
  194.            {
  195.                "birthday": "1990-04-15",
  196.                "deathday": null,
  197.                "id": 10990,
  198.                "name": "Emma Watson",
  199.                "gender": 1,
  200.                "popularity": 12.127983,
  201.                "place_of_birth": "Paris, France",
  202.                "profile_path": "\/pMjCFPe3oLBaVXw7qfFzrwA0WXD.jpg",
  203.                "adult": false,
  204.                "imdb_id": "nm0914612",
  205.                "homepage": null
  206.            },
  207.  
  208.            {
  209.                "birthday": "1982-10-10",
  210.                "deathday": null,
  211.                "id": 221018,
  212.                "name": "Dan Stevens",
  213.                "also_known_as": [" Daniel Jonathan Stevens"],
  214.                "gender": 2,
  215.                "popularity": 6.548622,
  216.                "place_of_birth": "Croydon, Surrey, England, UK",
  217.                "profile_path": "\/jNiY649MK85UFMosJIDxJ9HgIsC.jpg",
  218.                "adult": false,
  219.                "imdb_id": "nm1405398",
  220.                "homepage": "http:\/\/www.dan-stevens.co.uk"
  221.            },
  222.  
  223.            {
  224.                "birthday": "1978-11-28",
  225.                "deathday": null,
  226.                "id": 1128383,
  227.                "name": "Juana Acosta",
  228.                "also_known_as": [],
  229.                "gender": 1,
  230.                "popularity": 1.52391,
  231.                "place_of_birth": "Cali, Colombia",
  232.                "profile_path": "\/p3c7FK60Hz6rXYsSVjzdzTzQ3sk.jpg",
  233.                "adult": false,
  234.                "imdb_id": "nm0010207",
  235.                "homepage": "http:\/\/www.juana-acosta.com\/noticias\/"
  236.            },
  237.  
  238.            {
  239.                "birthday": "1927-10-14",
  240.                "deathday": "2017-05-23",
  241.                "id": 10222,
  242.                "name": "Roger Moore",
  243.                "also_known_as": ["&#47196;&#51200; &#47924;&#50612;", "Sir Roger Moore", "&#1057;&#1101;&#1088; &#1056;&#1086;&#1076;&#1078;&#1077;&#1088; &#1052;&#1091;&#1088;"],
  244.                "gender": 2,
  245.                "popularity": 4.30093,
  246.                "place_of_birth": "Stockwell, London, England, UK",
  247.                "profile_path": "\/8tnAaHY6cehjC9B6mIvxaFPewbh.jpg",
  248.                "adult": false,
  249.                "imdb_id": "nm0000549",
  250.                "homepage": "http:\/\/roger-moore.com"
  251.            },
  252.  
  253.            {
  254.                "birthday": "1945-02-12",
  255.                "deathday": null,
  256.                "id": 10342,
  257.                "name": "Maud Adams",
  258.                "also_known_as": [],
  259.                "gender": 1,
  260.                "popularity": 1.153331,
  261.                "place_of_birth": "Luleå, Norrbottens län, Sweden",
  262.                "profile_path": "\/iflQAeAUNW9zhwNGYCvk0nZR1en.jpg",
  263.                "adult": false,
  264.                "imdb_id": "nm0000726",
  265.                "homepage": null
  266.            },
  267.  
  268.            {
  269.                "birthday": "1972-05-02",
  270.                "deathday": null,
  271.                "id": 18918,
  272.                "name": "Dwayne Johnson",
  273.                "gender": 2,
  274.                "popularity": 16.545048,
  275.                "place_of_birth": "Hayward, California, USA",
  276.                "profile_path": "\/akweMz59qsSoPUJYe7QpjAc2rQp.jpg",
  277.                "adult": false,
  278.                "imdb_id": "nm0425005",
  279.                "homepage": null
  280.            },
  281.  
  282.            {
  283.                "birthday": "1964-04-20",
  284.                "deathday": null,
  285.                "id": 1333,
  286.                "name": "Andy Serkis",
  287.                "also_known_as": [],
  288.                "gender": 2,
  289.  
  290.                "popularity": 7.631553,
  291.                "place_of_birth": "Ruislip, Middlesex, UK",
  292.                "profile_path": "\/nQRsxFveJaUIlZ4GYWDe9uJ6u2f.jpg",
  293.                "adult": false,
  294.                "imdb_id": "nm0785227",
  295.                "homepage": "http:\/\/www.serkis.com\/"
  296.            },
  297. {
  298.  
  299. {
  300.                "birthday": "1979-05-09",
  301.                "deathday": null,
  302.                "id": 5916,
  303.                "name": "Rosario Dawson",
  304.                "also_known_as": ["&#47196;&#51088;&#47532;&#50724; &#46020;&#49832;"],
  305.                "gender": 1,
  306.                "popularity": 6.914163,
  307.                "place_of_birth": "New York City, New York, USA",
  308.                "profile_path": "\/dEK1rMmSJAPGdc2t1XWdbqBmvEq.jpg",
  309.                "adult": false,
  310.                "imdb_id": "nm0206257",
  311.                "homepage": "http:\/\/rosario-dawson.net\/"
  312.            },
  313. {
  314.                "birthday": "1960-11-05",
  315.                "deathday": null,
  316.                "id": 3063,
  317.                "name": "Tilda Swinton",
  318.                "also_known_as": [],
  319.                "gender": 1,
  320.                "popularity": 7.979976,
  321.                "place_of_birth": "London, United Kingdom",
  322.                "profile_path": "\/eGNo9qwlunvAi4kCVUEFtQFM5X.jpg",
  323.                "adult": false,
  324.                "imdb_id": "nm0842770",
  325.                "homepage": null
  326.            },
  327. {
  328.                "birthday": "1973-08-06",
  329.                "deathday": null,
  330.                "id": 21657,
  331.                "name": "Vera Farmiga",
  332.                "also_known_as": [],
  333.                "gender": 1,
  334.                "popularity": 5.146505,
  335.                "place_of_birth": "Clifton, Passaic County, New Jersey, USA",
  336.                "profile_path": "\/oWZfxv4cK0h8Jcyz1MvvT2osoAP.jpg",
  337.                "adult": false,
  338.                "imdb_id": "nm0267812",
  339.                "homepage": null
  340.            },
  341. {
  342.                "birthday": "1978-06-19",
  343.                "deathday": null,
  344.                "id": 8691,
  345.                "name": "Zoe Saldana",
  346.                "also_known_as": ["Zoë Saldana", "Zoe Saldaña", "Zoë Saldaña"],
  347.                "gender": 1,
  348.                "popularity": 11.831214,
  349.                "place_of_birth": "Passaic, New Jersey, USA",
  350.                "profile_path": "\/ofNrWiA2KDdqiNxFTLp51HcXUlp.jpg",
  351.                "adult": false,
  352.                "imdb_id": "nm0757855",
  353.                "homepage": "http:\/\/www.zoesaldana.com\/"
  354.            },
  355. {
  356.                "birthday": "1983-02-21",
  357.                "deathday": null,
  358.                "id": 19119,
  359.                "name": "Mélanie Laurent",
  360.                "also_known_as": [],
  361.                "gender": 1,
  362.                "popularity": 3.167659,
  363.                "place_of_birth": "Paris, France",
  364.                "profile_path": "\/iYMyK6jYf46NoLOxU0agUeCvtjN.jpg",
  365.                "adult": false,
  366.                "imdb_id": "nm0491259",
  367.                "homepage": null
  368.            },
  369.  
  370.        ];
  371.  
  372.  
  373.  
  374.        for (indiceGenero = 0; indiceGenero < artistas.length; indiceGenero++) {
  375.            var gender = artistas[indiceGenero].gender;
  376.            var nombre = artistas[indiceGenero].name;
  377.            if (gender == 1) {
  378.                console.log(nombre);
  379.            }
  380.  
  381.  
  382.        }
  383.  

Gracias de antemano!!
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines