-
Notifications
You must be signed in to change notification settings - Fork 1.7k
solution #1802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
solution #1802
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Test | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ master ] | ||
|
|
||
| jobs: | ||
| build: | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| node-version: [20.x] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| - run: npm install | ||
| - run: npm start & sleep 5 && npm test | ||
| - name: Upload tests report(cypress mochaawesome merged HTML report) | ||
| if: ${{ always() }} | ||
| uses: actions/upload-artifact@v2 | ||
| with: | ||
| name: report | ||
| path: reports |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -354,7 +354,36 @@ const people = [ | |
| }, | ||
| ]; | ||
|
|
||
| // eslint-disable-next-line no-console | ||
| console.log(people); // you can remove it | ||
| const table = document.querySelector('.dashboard'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You query the table with |
||
|
|
||
| // write your code here | ||
| people.forEach((person) => { | ||
| const row = document.createElement('tr'); | ||
|
|
||
| const cellName = document.createElement('td'); | ||
|
|
||
| cellName.textContent = person.name; | ||
|
|
||
| const cellGender = document.createElement('td'); | ||
|
|
||
| cellGender.textContent = person.sex; | ||
|
|
||
| const cellBorn = document.createElement('td'); | ||
|
|
||
| cellBorn.textContent = person.born; | ||
|
|
||
| const cellDied = document.createElement('td'); | ||
|
|
||
| cellDied.textContent = person.died; | ||
|
|
||
| const cellAge = document.createElement('td'); | ||
|
|
||
| cellAge.textContent = person.died - person.born; | ||
|
|
||
| const cellCentury = document.createElement('td'); | ||
|
|
||
| cellCentury.textContent = Math.ceil(person.died / 100); | ||
|
|
||
| row.append(cellName, cellGender, cellBorn, cellDied, cellAge, cellCentury); | ||
|
|
||
| table.append(row); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You append each |
||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider guarding the table query before using it to avoid runtime errors when .dashboard is not present. For example: const table = document.querySelector('.dashboard'); if (!table) { /* handle missing element or return */ }