隆Te damos la bienvenida a este reto!

1

隆Bienvenido al mundo de JavaScript!

D铆a 1

2

Variables, funciones y sintaxis b谩sica

3

Tipos de datos

4

Playground - Retorna el tipo

5

Tipos de datos - pt 2

D铆a 2

6

Operadores

7

Hoisting y coerci贸n

8

Playground - Calcula la propina

9

Alcance de las variables

D铆a 3

10

Condicionales

11

Playground - Calcula a帽os bisiestos

12

Switch

13

Playground - Obten informaci贸n de mascotas seg煤n su tipo

14

Ciclos

15

Playground - Dibuja un triangulo

D铆a 4

16

Arrays

17

Playground - Encuentra al michi mas famoso

18

Objetos

19

Playground - Obten el promedio de los estudiantes

D铆a 5 - Checkpoint

20

Playground - encuentra el palindromo m谩s grande

D铆a 6

21

Reasignaci贸n y redeclaraci贸n

22

Modo estricto

D铆a 7

23

Debugging y manejo de errores

24

Programaci贸n funcional

Quiz: D铆a 7

D铆a 8

25

Closures

26

Playground - Crea una calculadora con closures

27

Higher order functions

28

Playground - Crea tu propio m茅todo map

D铆a 9

29

ECMAScript

30

TC39

Quiz: D铆a 9

D铆a 10 - Checkpoint

31

ES6

32

ES7

33

Playground - Task planner

D铆a 11

34

Asincronismo

35

Playground - Promesas

36

Manejando el asincronismo

37

Playground - Resuelve el callback hell usando promesas

38

Playground - Resuelve el callback hell usando async/await

D铆a 12

39

Arrays a profundidad

40

M茅todos de arrays: Every, Find y findIndex

41

Playground - V谩lida el formulario

D铆a 13

42

M茅todos de arrays: Includes, Join y concat

43

Playground - agrupa los productos

44

M茅todos de arrays: Flat y FlatMap

45

Playground - Encuentra la ubicaci贸n del valor buscado

D铆a 14

46

Mutable functions

47

Playground - Modifica una lista de compras

48

M茅todos de arrays: sort

49

Playground - Ordena los productos

D铆a 15 - Checkpoint

50

Playground - Sistema de reservaciones de un hotel

D铆a 16

51

Programaci贸n orientada a objetos en JavaScript

52

Objetos literales

53

Playground - Congela el objeto recursivamente

D铆a 17

54

Prototipos en JavaScript

55

Playground - Modifica el prototype de los arrays

56

Playground - Crea un auto usando clases

D铆a 18

57

Abstracci贸n en JavaScript

58

Playground - Sistema de carrito de compras

59

Encapsulamiento en JavaScript

60

Playground - Encapsula datos de los usuarios

D铆a 19

61

Herencia en JavaScript

62

Playground - Jerarqu铆a de animales

63

Polimorfismo en JavaScript

64

Playground - Sistema de pagos

D铆a 20 - Checkpoint

65

Playground - Agenda de vuelos

D铆a 21

66

Patrones de dise帽o

67

Sinlgeton y Factory pattern en JavaScript

68

Playground - Implementa singleton en un chat

D铆a 22

69

Adapter y Decorator pattern en JavaScript

70

Playground - Personaliza productos de una tienda

71

Builder y Protype pattern en JavaScript

72

Playground - Mejora el c贸digo usando builder pattern

D铆a 23

73

Facade y proxy pattern en JavaScript

74

Playground - Proxy en servicio de mensajer铆a

75

Chain of responsability y Observer pattern en JavaScript

76

Playground - Implementaci贸n de Observador en Newsletter

D铆a 24 - Checkpoint

77

Playground - Crea un task manager con patrones de dise帽o

D铆a 25

78

Estructuras de datos en JavaScript

79

Playground - Crea tu propia implementaci贸n de un array

80

Hash tables en JavaScript

81

Playground - Implementaci贸n de una HashTable para Contactos

D铆a 26

82

Set en JavaScript

83

Playground - Remueve duplicados de una lista

84

Maps en JavaScript

85

Playground - Crea un organizador de tareas

D铆a 27

86

Singly Linked List en JavaScript

87

Playground - Agrega m茅todos a la singly linked list

88

Playground - Implementaci贸n de una singly linked list

D铆a 28

89

Stacks en JavaScript

90

Playground - Crea un stack para una playlist

D铆a 29

91

Queues en JavaScript

92

Playground - Crea una cola de emails

D铆a 30

93

隆Lo lograste!

Live Class

94

30 d铆as de JS con Juan DC

95

30 d铆as de JS con Nicobytes

96

30 d铆as de JS con GNDX

97

30 d铆as de JS con LeoCode

98

30 d铆as de JS con Teffcode

99

Sesi贸n: Cierre de los 30 d铆as de JavaScript

No tienes acceso a esta clase

隆Contin煤a aprendiendo! 脷nete y comienza a potenciar tu carrera

Playground - agrupa los productos

43/99

Aportes 84

Preguntas 0

Ordenar por:

驴Quieres ver m谩s aportes, preguntas y respuestas de la comunidad?

馃洝锔廍scudo anti-spoilers馃洝锔

Mi solucion:

export function groupProducts(products, category) {
  const res = {}

  //Productos que cumple con la categoria
  const category_products = products.filter(x => x.category == category)

  res['products'] = category_products.map(x => x.name).join(", ")
  res['totalPrice'] = category_products.reduce(((acum, { price }) => acum + price), 0)


  return res
}

Con ayuda de la programaci贸n funcional y el curso de manejo de arrays de NicoBytes.

export function groupProducts(products, category) {
  // Filtrar los produtos
  const products1 = products.filter(prod => prod.category === category);
  // Nombre de los productos separados por comas en orden
  const prodName = products1.map(prod => prod.name).join(', ');
  // Suma de los precios de productos de la categor铆a
  const sumPrices = products1.map(prod => prod.price).reduce((sum, curr) => sum + curr);

  return {
    products: prodName,
    totalPrice: sumPrices
  }
}

o estoy aprendiendo o este estaba f谩cil

馃洝锔忦煕★笍Escudo anti-spoilers馃洝锔忦煕★笍

Mi soluci贸n al reto

export function groupProducts(products, category) {
    let groupProducts = "";
    let totalPrice = 0;
  
    for (let product of products) {
      if (category === product.category) {
        groupProducts += (groupProducts.length > 0) ? `, ${product.name}` : `${product.name}`;
        totalPrice += product.price
      }
    }
  
    return {
      products: groupProducts,
      totalPrice: totalPrice
    }
}  
export function groupProducts(products, category) {
  let names = [];
  let sum = 0;
  products.forEach(product => {
    if (product.category === category) {
      names.push(product.name);
      sum += product.price;
    }
  });
  return {
    products: names.join(", "),
    totalPrice: sum
  }
}

solucion

export function groupProducts(products, category) {
  let arrayFilter = {};
  let acountPrice = 0;
  let acountName = [];


  products.forEach(element => {
    if (element.category === category) {
      //console.log(element);

      acountName.push(element.name);
      acountPrice += element.price;
    }
  });
  arrayFilter.products = acountName.join(", ");
  arrayFilter.totalPrice = acountPrice;
  return arrayFilter;
}

馃洝锔廍scudo anti-spoilers馃洝锔

tal vez est谩 poco entendible pero ahi esta, si alguien tiene duda se lo puedo explicar

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  return {
    products:
      products.filter(obj => obj.category === category)
              .map(obj => obj.name).join(", "),
    totalPrice:
      products.filter(obj => obj.category === category)
              .map(obj => obj.price)
              .reduce((acc, cur) => acc + cur, 0),
  };
}

Escudo anti-spoilers 馃洝锔

Les comparto mi solucion. ```js export function groupProducts(products, category) { const newProduct = { products: "", totalPrice: 0, }; const filtroProducts = products.filter(product => product.category === category); const filtroNames = filtroProducts.map(product => product.name); const namesProducts = filtroNames.join(", "); newProduct.products = namesProducts; const filtroPrice = filtroProducts.map(product => product.price) const sumaPrice = filtroPrice.reduce((acumulador, price) => acumulador + price); newProduct.totalPrice = sumaPrice; return newProduct; } ```function groupProducts(products, category) {聽 聽 const newProduct = {聽 聽 聽 聽 products: "",聽 聽 聽 聽 totalPrice: 0,聽 聽 };聽 聽 聽 聽 const filtroProducts = products.filter(product => product.category === category);聽 聽 const filtroNames = filtroProducts.map(product => product.name);聽 聽 const namesProducts = filtroNames.join(", ");聽 聽 newProduct.products = namesProducts; 聽 聽 const filtroPrice = filtroProducts.map(product => product.price)聽 聽 const sumaPrice = filtroPrice.reduce((acumulador, price) => acumulador + price);聽 聽 newProduct.totalPrice = sumaPrice;聽 聽聽 聽 return newProduct;}
export function groupProducts(products, category) {
  const filteredProducts = products.filter(product => product.category === category);

  const productNames = filteredProducts.map(product => product.name).join(", ");
  const totalPrice = filteredProducts.reduce((sum, product) => sum + product.price, 0);

  return {
    products: productNames,
    totalPrice: totalPrice,
  };
}

馃洝锔廍scudo anti-spoilers馃洝锔
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  console.log(category);
  if (category) {
    const filteredProducts = products.filter((product) => product.category === category);
    console.log(filteredProducts);
    let productResult = filteredProducts.reduce((acum, product) =>
      (acum + product.name + ', '), '');

    return {
      products: productResult.slice(0, -2),
      totalPrice: filteredProducts.reduce((acum, product) => 
        (acum + product.price), 0)
    }
  }
}

Soluci贸n! 馃槃

馃洝锔忦煕★笍馃洝锔廍scudo anti spoilers馃洝锔忦煕★笍馃洝锔

Agrupa los productos

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let totalPrice = 0;
  let productsName = [];
  products.forEach((element) => {
    if (element.category == category) {
      totalPrice += element.price;
      productsName.push(element.name);
    }
  });
  return { products: productsName.join(", "), totalPrice };
}

Mi soluci贸n

function groupProducts(products, category) {
  const bill = {
    products,
    totalPrice: 0
  }
  const productNames = []
  const productsByCategory = products.filter(product => product.category === category);
  productsByCategory.forEach(product => productNames.push(product.name));
  bill.products = productNames.join(', ');
  bill.totalPrice = productsByCategory.reduce((a, b) => a.price + b.price)
  return bill;
}
export function groupProducts(products, category) {
  const productFilteredData = products
    .filter(p => p.category === category)
    .map(p => ({ name: p.name, price: p.price }))
  return {
    products: productFilteredData.map(p => p.name).join(', '),
    totalPrice: productFilteredData.reduce((acc, item) => acc + item.price, 0)
  }
}
export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let productByCategory = products.filter(product => product.category === category);

  let productNames = products.map(product => product.name).join(', ');
  let totalPrice = product.map(product => product.price).reduce((previusValue, currentValue) => previusValue + currentValue);
  let result = {
    products: productNames,
    totalPrice = totalPrice
  }
  return result;
}

Comparto mi soluci贸n:

.
.
.
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  const result = {};
  const targetCategory = products.filter(function (product) {
    return product.category === category;
  });
  
  result.products = targetCategory.map(product =>
    product.name).join(", ");
  
  result.totalPrice = targetCategory.reduce(((acum, { price }) => acum + price), 0)
  
  return result;
}

Mi soluci贸n 馃挌

export function groupProducts(products, category) {
  let filteredProducts = products.filter((product) => product.category === category)

  return {
    products: filteredProducts.map((product) => product.name).join(', '),
    totalPrice: filteredProducts.reduce((total, actualProduct) => total + actualProduct.price, 0)
  }
}


.
.
.
.
.
.

export function groupProducts(products, category) {
    const filterProducts = products.filter(product => product.category === category);
    let output = {
        products: '', 
        totalPrice: 0
    }
    let nameProducts = [];
    filterProducts.forEach(product => { 
        nameProducts.push(product.name);
        output.totalPrice += product.price;
    })
    const totalProducts = nameProducts.join(', ');
    output.products += totalProducts;

    return output;
}  

Mi soluci贸n:

export function groupProducts(products, category) {
  const filteredByCategory = products.filter((product) => product.category === category);

  return {
    products: filteredByCategory.map(({name}) => name).join(', '),
    totalPrice: filteredByCategory.reduce((total, product) => total + product.price, 0),
  };
}
export function groupProducts(products, category) {
  let obj = {}
  const resultFilter = products.filter(product => product.category === category)
  obj['products'] = resultFilter.map(pro => pro.name).join(', ');
  obj['totalPrice'] = resultFilter.map(pro => pro.price).reduce((total, valor) => total + valor, 0);
  return obj;
}
function groupProducts(products, category) {
  let product = new Array()
  let sum = 0

  products.forEach(element => {
    if (element.category == category) {
      product.push(element.name)
      sum += element.price
    }
  });

  // imprimir el objeto
  console.log({
    products: product.join(", "),
    totalPrice: sum
  })
}

MI Soluci贸n:


export function groupProducts(products, category) {
  let totalPrice = 0;
  let productName = []
  products.map(product => {
    if (product.category === category) {
      productName.push(product.name);
      totalPrice += product.price;
    }
  });
  products = productName.join(", ");
  return { products, totalPrice }
}


sin usar programaci贸n funcional, lo siento, pero aun me cuesta usar las funciones an贸nimas y flecha. Pero funciona.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let productos = ''
  let total = 0
  for (const [key, value] of Object.entries(products)) {
    if (value.category == category) {
      total += value.price
      productos += value.name + ', '
    }
  }
  productos = productos.slice(0, -2);
  return { products: productos, totalPrice: total }  
}

Mi soluci贸n al reto.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let filterProducts = []
  let total = 0

  products.forEach(e => {
    if (e.category === category) {
      filterProducts.push(e.name)
      total += e.price
    }
  })

  return {
    products: filterProducts.join(", "),
    totalPrice: total
  }
}

comparto mi soluci贸n al reto

export function groupProducts(products, category) {
  const filteredProducts = products.filter(product => product.category == category)
  //console.log(filteredProducts);
  const totalPrice = filteredProducts.reduce((acumulator, currentValue) => acumulator += currentValue.price, 0)
  //console.log(totalPrice);
  const productsName = filteredProducts.map(product => product.name)
  //console.log(productsName);

  const joinName = productsName.join(', ')
  const data = {
    products: joinName,
    totalPrice: totalPrice
  }
  //console.log(data);
  return data;
}
export const groupProducts = (products, category) => {
  const group = products.filter(product => product.category === category);

  return {
    'products': group.map(product => product.name).join(', '),
    'totalPrice': group.reduce((total, product) => total + product.price, 0)
  }
}

dejo mi solucion por aqui
.
.
.
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  const productos = products.filter(el => el.category === category);
  const productsPrices = [];
  const productNames = [];
  productos.forEach(el => {
    productsPrices.push(el.price);
  });
  const totalPrice = productsPrices.reduce((a, b) => a + b, 0);

  productos.forEach(el => {
    productNames.push(el.name);
  });

  return {
    products: productNames.join(', '),
    totalPrice: totalPrice,
  };
}

Hola Comparto mi soluci贸n:

















export function groupProducts(products, category) {
  const findProducts = [];
  let totalPrice = 0;

  products.forEach((product) => {
    if (product.category === category) {
      findProducts.push(product.name);
      totalPrice += product.price;
    }
  });

  return {
    products: findProducts.join(", "),
    totalPrice: totalPrice,
  };
}

APORTE:


SPOILER

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

<code> 
export function groupProducts(products, category) {
  // Tu c贸digo aqu铆

  let arrayProducts = [];
  let price = 0;

    let filteredArray = products.filter(element => element.category==category)

  if (filteredArray.length > 0) {
    for (let element of filteredArray) {
      arrayProducts.push(element.name);
      price += element.price;
    }
    return { products: arrayProducts.join(", "), totalPrice: price };
  }
  else { 
    return null;
  }

Para el nivel de complejidad que ten铆an los ejercicios previos, me imagin茅 este mucho m谩s dif铆cil鈥

v
v
v
v
v
v
v
v
v
v
v
v

export function groupProducts(products, category) {
  let ProductOutput = []
  let totalPrice = 0
  products.forEach((product) => {
    if (product.category === category) {
      ProductOutput.push(product.name)
      totalPrice += product.price
    }
  })
  return {
    products: ProductOutput.join(', '),
    totalPrice: totalPrice
  }
}

function groupProducts(products, category) {
  // Tu c贸digo aqu

  const productsByCategory = products.filter(item => item.category === category)

  const object = {
    products: productsByCategory.map(item => item.name).join(", "),
    totalPrice: productsByCategory.reduce((acum, sum) => acum + sum.price, 0)
  }

  return object
}

.

my solution

.

export function groupProducts(products, category) {
  const result = products
    .filter((product) => product.category === category)
    .reduce((acc, prod) => {
      return {
        products: [...acc.products, prod.name],
        totalPrice: acc.totalPrice + prod.price
      }},
      {
        products: [],
        totalPrice: 0
      })
  return {
    products: result.products.join(', '),
    totalPrice: result.totalPrice
  }
}

Challenge exceeded

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let totalPrice = 0
  let productName = ''

  let productsByCategory = products.filter(product => product.category === category)

  for (let i of productsByCategory) {
    totalPrice += i.price
  }

  for (let i of productsByCategory) {
    if (!productName.length) {
      productName += `${i.name}`
    } else {
      productName += `, ${i.name}`
    }
  }

  return {
    products: productName,
    totalPrice
  }
}

馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔
馃洝锔

export function groupProducts(products, category) {

  let listofproductsbycategory = [];
  let total = 0;
  products.map(eachProduct => {
    
    if (eachProduct.category === category) {
      listofproductsbycategory.push(eachProduct.name);
      total += eachProduct.price;
    }
  })
  return {
    products: listofproductsbycategory.join(', '),
    totalPrice: total

  }
}```

Soluci贸n

function groupProducts(products, category) {
  // Tu c贸digo aqu铆

  const filteredProducts = products.filter(product => category === product.category)
  const pNames = filteredProducts.map(prod => prod.name)
  const pPrices = filteredProducts.map(prod => prod.price).reduce((acc, cur) => acc + cur, 0)
  
  const queriedProducts = {
    products: pNames.join(", "),
    totalPrice: pPrices
  }

  console.log(queriedProducts)
  return queriedProducts
}

mi solucion aunque me falta refinarla un poco queria probar la logica de como no ingresar la coma y el espacio.

export function groupProducts(products, category) {
  let rta = { products: '', totalPrice: 0, };
  let k = products.filter(x => x.category === category).length;
  for (let index = 0; index < products.length; index++) {
    const element = products[index];
    if (element.category === category) {
      if (k != 1) {
        rta = { products: rta.products + element.name + ', ', totalPrice: rta.totalPrice + element.price };
        k--;
      } else {
        rta = { products: rta.products + element.name, totalPrice: rta.totalPrice + element.price };
      }
    }
  }
  return rta;
}

Cuidado Spoiler

Mi solucion

export function groupProducts(products, category) {
  const categoryProducts = products.filter(
    product => product.category === category
  )
  const categoryTotal = categoryProducts.reduce(
    (total, product) => total += product.price
    , 0)

  const productNames = categoryProducts.map(product => product.name).join(", ")

  return {
    products: productNames,
    totalPrice: categoryTotal
  } 
}

Cuando se le pilla el punto, esto de jugar con las funciones es muy potente
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  const prodCategoria = products.filter((item) => item.category == category);
  const names = prodCategoria.flatMap((item)=>item.name).join(", ");
  const totalPrice = prodCategoria.reduce((total, item) => total + item.price,0);
  return { products:names,totalPrice };
}

Buenas, comparto mi solucion, la verdad me siento muy orgulloso ya que lo realice sin necesidad de ninguna ayuda, me costo dure como tres horas pero al final lo logre, al final no me habia dado cuenta y le habia puesto una 鈥榮鈥 mas en el objeto de retorno al totalPrice jajajajaja, le comparto mi codigo:


Mi aporte

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let prods = "";
  let price = 0;
  products.forEach(el => {
    if (el.category === category) {
      prods = prods + el.name + ", ";
    price = price + el.price
    }
  });

  let result = {
    products: prods.trimEnd().slice(0, prods.length - 2),
    totalPrice: price
  }

  return result

}


















export function groupProducts(products, category) {
  let data = products.filter((element) => element.category === category);
  const totalPrice = data.reduce((suma, number) => suma.price + number.price);
  const productsName = data.reduce((array, elem) => {
    array.push(elem.name)
    return array
  },[]) 
  
  return { products: productsName.join(', '), totalPrice}
  
}

馃挗 馃挗 馃挗 ANTI SPOILER 馃挗 馃挗 馃挗

Mi respuesta.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  const groupProducts = {
    products: [],
    totalPrice: 0
  };
  products.forEach(product => {
    if (product.category == category) {
      groupProducts.products.push(product.name);
      groupProducts.totalPrice += product.price;
    }
  });

  groupProducts.products = groupProducts.products.join(", ");
  return groupProducts;
}

Solucion1. Metodos filter, map y reduce.

export function groupProducts(products, category) {
  const filtered = products.filter(product => product.category === category);
  return {
    products: filtered.map(product => product.name).join(", "),
    totalPrice: filtered.reduce((acc, val) => acc.price + val.price)
  }
}

Solucion 2. Metodo reduce + metodo concat:

    export function groupProducts(products, category) {
  return products.reduce((acc, val) => {
    if (acc.products === undefined) {
      acc.products = '';
      acc.totalPrice = 0;
    }
    if (val.category === category) {
      if (acc.products !== '') {
        acc.products = acc.products.concat(', ' + val.name);
      } else {
        acc.products = val.name;
      }
      acc.totalPrice += val.price;
    }
    return acc;
  }, {})
}
export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let subTotal = 0;
  const items = [];
  const productByCategoria = products.filter((product) => {
    if (product.category === category) {
      items.push(product.name);
      subTotal += product.price;
      return true;
    }
  });
  return { products: items.join(', '), totalPrice: subTotal };
}

Comparto mi soluci贸n
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  const filtered = products.filter((p) => p.category === category)
  const totalPrice = filtered.reduce((a, p) => a + p.price, 0);
  const productsString = filtered.map(p => p.name).join(", ");
  return {
    products: productsString,
    totalPrice
  }

}

Linda la propuesta de devolver los productos como un string鈥 馃槂

export function groupProducts(productos, category) {
  // Tu c贸digo aqu铆

  const productsfilters = productos.filter(
    product => product.category === category)
    .reduce((acc, curr) => {

      if (acc.products.length === 0) {
        return {
          products: acc.products.concat(curr.name),
          totalPrice: acc.totalPrice + curr.price
        }
      } else {

        return {
          products: acc.products.concat(", ").concat(curr.name),
          totalPrice: acc.totalPrice + curr.price
        }

      }

    }, {
      products: "",
      totalPrice: 0,
    });


  return productsfilters;
};

mi soluci贸n:
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
    // Tu c贸digo aqu铆
    const groupedProducts = {};
  
    const filteredProducts = products.filter(product => product.category === category);

    groupedProducts.products = filteredProducts.map(product => product.name).join(", ");
    groupedProducts.totalPrice = filteredProducts.map(product => product.price).reduce((acumulador, numero) => acumulador + numero);
  
    return groupedProducts;
}

Ez

export function groupProducts(products, category) {
  let output = {
    products: [],
    totalPrice: 0
  }

  products.map((item) => { 
    if (item.category == category) {
      output.totalPrice += item.price
      output.products.push(item.name)
    }
  })

  output.products = output.products.join(", ")
  return output;
}

Mi solucion:

export function groupProducts(products, category) {
  const arrayproductos = [];
  let total = 0;
  for (let i = 0; products.length > i; i++) { 
    const producto = products[i].name;


    if (category === products[i].category) { 
      arrayproductos.push(products[i].name);
      total = total + products[i].price;
    }
  }
  let nombreproducto = arrayproductos.join(", ")

  let result = {
    products: nombreproducto,
    totalPrice: total
  }

  return result;
}

Mi versi贸n de la soluci贸n, con lo aprendido:

  let descripProducts = "";
  let totalPrice = 0;

  products.filter((value) => {
    if (value.category === category) {
      if (descripProducts === "") {
        descripProducts = value.name;
      } else {
        descripProducts = `${descripProducts}, ${value.name}`;
      }
      totalPrice = totalPrice + value.price;
      return value;
    }
  });

  return (products = {
    products: descripProducts,
    totalPrice: totalPrice,
  }); 

MI SOLUCION 馃挭
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  const producstByCategoty = products.filter(product => product.category === category);
  const nameProducts = producstByCategoty.map(product => product.name).join(", ");
  const totalPrice = producstByCategoty.reduce((total, product) => total + product.price, 0);
  return {
    products: nameProducts,
    totalPrice
  };
}

Esta es mi soluci贸n, cuidado con los spoilers:
.
.
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  let totalPrice = 0;
  let pNameArray = [];

  let selectedProducts = products.filter(item => item.category === category);

  selectedProducts.forEach(item => {
    totalPrice += item.price;
    pNameArray.push(item.name);
  });

  let auxPName = pNameArray.join(", ");
  return { "products": auxPName, "totalPrice": totalPrice };
}

Mi soluci贸n:

export function groupProducts(products, category) {
  let output = {
    products: "",
    totalPrice: 0
  }
  const filteredProducts = products.filter((product) => product.category === category)

  output.products = filteredProducts.map(({ name }) => name).join(", ")

  filteredProducts.forEach((product) => output.totalPrice += product.price)

  return output
}

estaba facil

export function groupProducts(products, category) {
  const filteredByCategory = products.filter(item => item.category == category)
  const names = filteredByCategory.map(item => item.name).join(', ')
  const suma = filteredByCategory.reduce((a, b) => a + b.price, 0)

  return { products: names, totalPrice: suma }
} 

++
+
+
+
+
++
+
+

export function groupProducts(products, category) {
  let productsFilter = products.filter((product) => {
    return product.category === category;
  })
  let productos = {
    products: "",
    totalPrice: 0
  }
  let nameProducts = [];
  for (const [key, value] of Object.entries(productsFilter)) {
    nameProducts.push(value.name);
    productos.totalPrice += value.price;
  }
  productos.products = nameProducts.join(", ");
  return productos;
}

Aqu铆 mi soluci贸n usando un for in:

export function groupProducts(products, category) {
  let totalPrice = 0;
  var prod = [];
  const result = products.filter(prod => prod.category === category);
  for (const prop in result) {
    prod.push(result[prop].name);
    totalPrice += result[prop].price;
  }
  return { products: prod.join(", "), totalPrice };
}

馃洝锔廍scudo anti-spoilers馃洝锔

export function groupProducts(products, category) {
  return {
    products: products.filter(item => item.category === category).map(item => item.name).join(', '),
    totalPrice: products.filter(item => item.category === category).reduce((a, c) => a + c.price, 0)
  };
}


Solu
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

function groupProducts(products, category) {

const selectedProducts = products.filter(product => product.category === category);
let selectedNames = [];
let sumatoryOfPrices = 0;

for(let i=0; i<selectedProducts.length; i++){
selectedNames.push(selectedProducts[i].name);
sumatoryOfPrices = sumatoryOfPrices + selectedProducts[i].price;
};

return {
products: selectedNames.join(", "),
totalPrice: sumatoryOfPrices
}
}

Aqu铆 mi soluci贸n:
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

<export function groupProducts(products, category) {
  //filtro los productos segun la cateoria en productsCategory
  let productsCategory = products.filter(item => item.category == category);
  //sumo el precio de los productos filtrados
  let sumtotal = productsCategory.reduce((sum, item) => sum + item.price, 0);
  //obtengo el name de los productos filtrados en productoName
  let productsName = productsCategory.map((item) => item.name).join(', ');
  return { products: productsName, totalPrice: sumtotal };
}> 

the sol guys:

export function groupProducts(products, category) {
  const filteredproducts = products.filter(item => item.category === category);
  let result = {products: "", totalPrice: 0};
  for (const product of filteredproducts) {
    if (result.products == "") {
      result.products = result.products.concat('', product.name);
    } else {
      result.products = result.products.concat(', ', product.name);
    }
    result.totalPrice += product.price;
  }
  return result;
}

Hola, aqui mi soluci贸n. Use el metodo filter y un simple bucle for of
.
.
.
.
.
.
.

function groupProducts(products, category) {
  const filteredProducts = products.filter((product) => product.category == category)
  const names = []
  let totalPrice = 0
  for (let product of filteredProducts) {
    names.push(product.name)
    totalPrice += product.price
  }
  return { products: names.join(", "), totalPrice }
}

Hola! aqu铆 mi soluci贸n 馃榾
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  const filteredProducts = products.filter((product) => product.category === category)
  return {
    products: filteredProducts.map((product) => product.name).join(', '),
    totalPrice: filteredProducts.reduce((acum, product) => acum + product.price, 0)
  }

}
export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  const filteredProducts = products.filter(product => product.category === category)

  const mappedProducts = filteredProducts.map(product => product.name)

  const totalPrice = filteredProducts.reduce((acc, curr) => acc + curr.price, 0) 

  return {
      products: mappedProducts.join(", "),
      totalPrice
  }
}

.
.
.
.
.
.
.
.
.
Mi soluci贸n solo con reduce

export const groupProducts = (products,category,) =>
  products.reduce(
    (obj, product) => {
      if (product.category === category) {
        obj["totalPrice"] = obj["totalPrice"] + product.price;
        obj["products"] = (!obj["products"])
          ? product.name
          : obj["products"].concat(`, ${product.name}`);
      }
      return obj;
    },
    { products: "", totalPrice: 0 },
  );

SPOILLLLLLLLEER
.
.
.
.
.
.
.
.
.

  const productsByCategory = products.filter(
    (product) => product.category === category
  );

  const productsName = productsByCategory
    .map((product) => product.name)
    .join(', ');

  const totalPrice = productsByCategory.reduce(
    (acum, product) => acum + product.price,
    0
  );

  return {
    products: productsName,
    totalPrice,
  };

Mi soluci贸n
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  const productsByCategory = [];
  let totalPrice = 0;

  products
    .filter((product) => {
      return product.category === category;
    })
    .map((product) => {
      productsByCategory.push(product.name);
      totalPrice += product.price;
    });

  return {
    products: productsByCategory.join(", "),
    totalPrice: parseInt(totalPrice),
  };
}

Soluci贸n鈥 馃槃
.
Un reto bastante divertido, primero filtramos los productos por su categor铆a mediante la funci贸n filter().
.
Luego, creamos un array con 煤nicamente los nombres de los productos filtrados, utilizando map() y la funci贸n join(", ") que nos devolver谩 una cadena con los productos separados por ", ".
.
Finalmente, acumulamos el precio de los productos filtrados en una variable mediante reduce(), y retornamos un objeto con las propiedades correspondientes.
.

export function groupProducts(products, category) {
  // Filtramos por categor铆a
  let filtered = products.filter((product) => product.category === category);

  // Creamos un array con los nombres de los fittrados
  let productNames = filtered.map((product) => product.name).join(", ");

  // Accumulamos el precio total de los filtrados
  let price = filtered.reduce((acc, product) => {
    return acc + product.price;
  }, 0);

  // Retornamos el objeto
  return {
    products: productNames,
    totalPrice: price
  };

}

Mi Soluci贸n
*
*
*
*
*
*
*

export function groupProducts(products, category) {
 
  const filteredProducts = products.filter(prod => prod.category === category)

  const productNames = filteredProducts.map(prod => prod.name).join(', ')

  const totalPrice = filteredProducts.reduce((acc,cur) => acc + cur.price, 0)

  return {
    products: productNames,
    totalPrice
  }
}

隆Hola, Desaf铆o cumplido 馃槂!
Mi soluci贸n,
Se detalla hasta abajo.猬








export function groupProducts(products, category) {
  const even = (element) => element.category === category;
  const filterByCategory = products.some(even);

  let rta = { products: "", totalPrice: 0 };
 

  if (filterByCategory) {
    const myList = products.filter(even);
    const myNames = myList.map(item => item.name);
    rta.products = myNames.join(", ");
    rta.totalPrice= myList.reduce(
      (accumulator, currentValue) => accumulator + currentValue.price, 0
    );

  }
  return rta;
}

Aqu铆 dejo mi soluci贸n usando los m茅todos de los contenidos. Espero les ayude:

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let reply = {
    products: "",
    totalPrice: 0,
  }

  let categories = products.map(element => element.category)
  if (categories.includes(category)) {
    let matchedProducts = products.filter(product => product.category == category)
    let matchedProductsNameList = []
    matchedProducts.forEach(product => {
      reply.totalPrice += product.price
      matchedProductsNameList.push(product.name)
    });
    reply.products = matchedProductsNameList.join(", ")
  }

  return reply
}

Mi soluci贸n
.
.
.
.
.
.

export function groupProducts(products, category) {
  let total_products = { products: '', totalPrice: 0 };
  let product_list_name = [];
  let products_find = products.filter(product => {
    return product.category == category;
  });
  products_find.forEach(product => {
    product_list_name.push(product.name);
    total_products.totalPrice += product.price;
  })
  total_products.products = product_list_name.join(', ');
  return total_products;
}

.
.
.
.
.
.
.

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let nameProduct = [];
  let totalPrice = 0;
  products.forEach(product => {
    if (product.category === category) {
      nameProduct.push(product.name);
      totalPrice += product.price
    }
  });

  return {products: nameProduct.join(', '), totalPrice: totalPrice}
}

.
.

.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.

Mi solucion :3

export function groupProducts(products, category) {
  let outProducts = products.reduce((acc, curr) => {
    if (curr.category == category) {
      acc.products.push(curr.name)
      acc.totalPrice += curr.price
    }
    return acc
  }, { products: [], totalPrice: 0 })

  outProducts.products = outProducts.products.join(', ')
  return outProducts
}

Soluci贸n n.n

.
.
.
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
    let totalPrice = 0
    let productsFilter = products.filter(product => {
    if (product.category === category) {
            totalPrice += product.price
            return true
        }
        return false
    }).map(product => product.name)
    
    return {
        products: productsFilter.join(', '),
        totalPrice
    }
}

MI soluci贸n:

Curiosa la peque帽a trampilla del espacio jajaja,o bueno, para mi fue curiosa:

export function groupProducts(products, category) {
  const categoria = products.filter((a) => a.category == category);
  const producto = categoria.map((a) => a.name);
  const total = categoria.reduce((a, b) => a.price + b.price);
  return {
    products: producto.join(", "),
    totalPrice: Number(total),
  };
}

Hola, dejo mi solucion
Caminito anti spoilers
馃殫
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Llegamos 馃搷

const productsCategory = products.filter((product) => product.category === category)
    const productsName = productsCategory.map((product) => product.name)
    const productsSum = productsCategory.reduce((acumulador, numero) => (acumulador + numero.price), 0);
    return {
        products: productsName.join(', '), 
        totalPrice: productsSum
    }

Soluci贸n

export function groupProducts(products, category) {
  // Tu c贸digo aqu铆
  let productsByCategory = [];
  let totalPrice = 0;
  products.forEach(product => {
    if (product.category === category) {
      productsByCategory.push(product.name);
      totalPrice += product.price;
    }
  });
  return {
    products: productsByCategory.join(", "),
    totalPrice: totalPrice
  }
}

Adjunto mi soluci贸n:
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {
  const productsPerCategory = []
  let totalPrice = 0
  products.forEach(product => {
    if (product.category.includes(category)) {
      productsPerCategory.push(product.name)
      totalPrice += product.price
    }
  })
  return {
    products: productsPerCategory.join(', '),
    totalPrice
  }
}
export function groupProducts(products, category) {

  let sortProducts = [];
  let total = 0;

  for (let product of products) {

    if (product.category === category) {
      sortProducts.push(product.name);
      total += product.price;
      }
    
  }

  return {
    products: sortProducts.join(", "),
    totalPrice: total,
  }

 
}

Mi aporte:
.
.
.
.
.
.
.
.
.
.
.

function groupProducts(products, category) {

    let myProducts = [];
    let prices = [];

    products.forEach(element => {
        if(element.category === category){
            myProducts.push(element.name);
            prices.push(element.price);
        }        
    });
    let total = prices.reduce((sum, num) => sum + num, 0);

return {"products": myProducts.join(", "), totalPrice: total}
 
};

Alerta Spoiler
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {

  const categoryFilter = products.filter(prod => prod.category === category);

  const products = categoryFilter.reduce((a, b) => `${a.name}, `.concat(b.name));

  const totalPrice = categoryFilter.reduce((a, b) => a.price + b.price);

  return ({
    products,
    totalPrice
  })
}

Aporto mi soluci贸n
.
.
.
.
.
.
.
.
.
.
.
.

export function groupProducts(products, category) {

  //Creo un arreglo de productos y declaro e inicializo sumaPrecios en 0
  let cadenaProductos = []
  let sumaPrecios = 0

  //Compruebo todos los productos que coincidan con la categor铆a que recib铆 como par谩metro y los que coinciden los agrego a cadenaProductos que por el momento es un array y agrego su precio a sumaPrecios
  products.forEach(producto => {
    if (producto['category'] === category) {
      cadenaProductos.push(producto['name'])
      sumaPrecios+=producto['price']
    }
  })

  //Una vez que filtr茅 todos los productos los convierto en un string con el m茅todo join
  cadenaProductos = cadenaProductos.join(', ')
  
  return {
    products: cadenaProductos,
    totalPrice: sumaPrecios
  }
}

Spoiler:
.
.
.
.
.
.
.
.
.
.

function groupProducts(products, category) {
    const names = products
    .filter(prod => prod.category === category)
    .reduce((a, b) => `${a.name}, ${b.name}`);

    const prices = products
    .filter(prod => prod.category === category)
    .reduce((a, b) => a.price + b.price);

    return{
        products: names, 
        totalPrice: prices
    };
};
undefined