DEV Community

Dezina
Dezina

Posted on • Updated on

forEach() vs map

forEach()

  props.comments.forEach(function (cancom, i) {
        commentBlock.push(
          <div key={i}>
            <ul>
              <li style={{ fontSize: "14px" }}>Status: {cancom.status}&nbsp;&nbsp;<u>Comment:</u>&nbsp;&nbsp; {cancom.com}  - by <b>{cancom.by}</b> <span style={{ fontSize: "10px" }}> {new Date(cancom.on).toLocaleDateString()}</span></li>
            </ul>
          </div>
        );
    });
Enter fullscreen mode Exit fullscreen mode

Top comments (0)