Javascript Dynamic Grid Assignment

@shivam-ta-fsr. My marks have been deducted in Javascript Dynamic Grid Assignment stating that I have copied the code from Abhishek. I don’t even know who Abhishek is. As I already mentioned that I wasn’t able to attend the sessions that week and I completed them on the weekend. That’s why I submitted the assignment late. The assignment was discussed on Monday. Please don’t put false accusations.

i am not putting false accusations you can check both code.

this is abhishek code

let clothing = [];
let accessory = [];

for (let i = 0; i < productList.length; i++) {
if (productList[i].isAccessory == false) {
clothing.push(productList[i]);
} else {
accessory.push(productList[i]);
}
}
console.log(clothing, accessory);

// generating the cards

let clothingCardContainer = document.getElementById(“clothingCards”);
let accessoriesCrdsContainer = document.getElementById(“accessoryCards”);

function generateCard(product) {
let card = <div class="card"> <div class="image"> <img src= ${product.preview} alt=${product.name} /> </div> <div class="info"> <p class="name">${product.name}</p> <p class="brand"> ${product.brand}</p> <p class="price"> Rs ${product.price}</p> </div> </div> ;
return card;
}

// adding the product into the cards

for (let i = 0; i < clothing.length; i++) {
let htmlCard = generateCard(clothing[i]);
clothingCardContainer.innerHTML += htmlCard;
}

for (let i = 0; i < accessory.length; i++) {
let htmlCard = generateCard(accessory[i]);
accessoriesCrdsContainer.innerHTML += htmlCard;
}

1 Like

this is yours code

let clothingCardContainer = document.getElementById(“clothingCards”)
let accessoryCardContainer = document.getElementById(“accessoryCards”)

function generateCard(product){
let card =
<div class = "card"> <div class = "image"> <img src = ${product.preview} alt = ${product.name}/> </div> <div class = "info"> <p class = "name">${product.name}</p> <p class = "brand">${product.brand}</p> <p class = "price"><b>Rs ${product.price}</b></p> </div> </div>
return card
}

let clothing = []
let accessory = []

for(let i=0;i<productList.length;i++){
if(productList[i].isAccessory == false){
clothing.push(productList[i])
}
else{
accessory.push(productList[i])
}
}

for(let i=0; i<clothing.length; i++){
let htmlCard = generateCard(clothing[i])
clothingCardContainer.innerHTML += htmlCard
}

for(let i=0; i<accessory.length; i++){
let htmlCard = generateCard(accessory[i])
accessoryCardContainer.innerHTML += htmlCard
}

@shivam-ta-fsr The code seems to be similar because it was discussed in one of the sessions. I don’t even know who Abhishek is. This is seriously not done. I wrote it down with the reference from the class.

okk updating the marks soon