mirror of
https://github.com/10h30/odin-javascript-exercises.git
synced 2026-07-15 12:43:19 +09:00
@@ -1,4 +1,4 @@
|
||||
# GET THE TITLES!
|
||||
# Get the Titles!
|
||||
|
||||
You are given an array of objects that represent books with an author and a title that looks like this:
|
||||
|
||||
@@ -24,4 +24,3 @@ getTheTitles(books) // ['Book','Book2']
|
||||
## Hints
|
||||
|
||||
- You should use a built-in javascript method to do most of the work for you!
|
||||
<Paste>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var getTheTitles = function() {
|
||||
const getTheTitles = function() {
|
||||
|
||||
}
|
||||
|
||||
module.exports = getTheTitles
|
||||
module.exports = getTheTitles;
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
const getTheTitles = require('./getTheTitles')
|
||||
const getTheTitles = require("./getTheTitles");
|
||||
|
||||
describe('getTheTitles', () => {
|
||||
const books = [
|
||||
{
|
||||
title: 'Book',
|
||||
author: 'Name'
|
||||
},
|
||||
{
|
||||
title: 'Book2',
|
||||
author: 'Name2'
|
||||
}
|
||||
]
|
||||
describe("getTheTitles", function () {
|
||||
const books = [
|
||||
{
|
||||
title: "Book",
|
||||
author: "Name",
|
||||
},
|
||||
{
|
||||
title: "Book2",
|
||||
author: "Name2",
|
||||
},
|
||||
];
|
||||
|
||||
test('gets titles', () => {
|
||||
expect(getTheTitles(books)).toBe(['Book','Book2']);
|
||||
test("gets titles", () => {
|
||||
expect(getTheTitles(books)).toBe(["Book", "Book2"]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user