Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
agumusay committed Mar 19, 2020
1 parent 2b32142 commit 5a65cea
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/scripts/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
// The following line makes sure your styles are included in the project. Don't remove this.
import "../styles/main.scss";
import "regenerator-runtime/runtime";
import React from "react";
import ReactDom from "react-dom";
import Faker from "faker";
// Import any additional modules you want to include below \/

// \/ All of your javascript should go here \/

//Counter and empty array
let listCount = 4;
let listItems = [];

//Loop how many list items you want to create
while (listCount) {
//Create Random information with Faker
let randomName = Faker.name.findName();
let randomEmail = Faker.internet.email();
let randomPhone = Faker.phone.phoneNumber();
//Create a list elelement on every iteration
let listItem = React.createElement("li", {}, randomName, React.createElement("a", {}, randomPhone), React.createElement("a", {}, randomEmail));
listItems.push(listItem);
listCount--;
}

//Create ul element add a header and span inside, and finally listItems array
let listContainer = React.createElement("ul", {}, React.createElement("h1", {}, "My ", React.createElement("span", { className: "highLight" }, "awesome "), "contacts list"), listItems);

//append the Ul element inside the container
ReactDom.render(listContainer, document.querySelector(".container"));

0 comments on commit 5a65cea

Please sign in to comment.