We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e829e0 commit 1179bd6Copy full SHA for 1179bd6
Retos/Reto #11 - URL PARAMS [Fácil]/javascript/Joselyn96.js
@@ -0,0 +1,17 @@
1
+/*
2
+ * Dada una URL con parámetros, crea una función que obtenga sus valores.
3
+ * No se pueden usar operaciones del lenguaje que realicen esta tarea directamente.
4
+ *
5
+ * Ejemplo: En la url https://retosdeprogramacion.com?year=2023&challenge=0
6
+ * los parámetros serían ["2023", "0"]
7
+ */
8
+
9
10
+function getQueryParams(param_url) {
11
+ if(!param_url.includes("?")) return "No hay parámetros en la URL";
12
+ let parts = param_url.split("?")[1].split("&");
13
+ let url_params = parts.map(param => param.split("=")[1]);
14
+ return url_params;
15
+}
16
17
+console.log(getQueryParams("https://retosdeprogramacion.com?year=2023&challenge=0"));
0 commit comments