alive ? cell.classList.add('alive') : cell.classList.remove('alive');
<!DOCTYPE html>
<html>
<head>
<title>Game of Life</title>
<style>
#grid {
display: flex;
flex-wrap: wrap;
width: 200px;
height: 200px;
}
.cell {
width: 10px;
height: 10px;
border: 1px solid black;
.alive {
background-color: pink;
</style>
</head>
<body>
<div id="grid"></div>