GSG-G10 / DevMonkeys-Ecommerce

0 stars 1 forks source link

Const and let #40

Open Mu7ammadAbed opened 3 years ago

Mu7ammadAbed commented 3 years ago

Since you are not going to change the value of the variable (reassign) you should use const

https://github.com/GSG-G10/DevMonkeys-Ecommerce/blob/0b47b4ec1f48ee4bd3270d6c49b4f9ce9c2a47b9/js/logic.js#L23-L26

and you should write more descriptive variables/arguments names so you can write this function in es6 to become

const deleteItem = (products, item) => products.filter((elem) => elem.id !== item.id);
omar-shaath commented 3 years ago

Eagle eye Muhammad, Mashallah!