Tell us what’s happening:
i get the correct output but get an error message .code,error message and output are included
// running tests
3. When called with "A | B | C | D", parseCard should return an array with four elements.
// tests completed
// console output
[ 'The Stand | King, Stephen | 1978 | Shelf K2' ]
const rawCatalogCards = [
"From a Buick 8 | King, Stephen | 2002 | Shelf K7",
"The Shining | King, Stephen | 1977 | Shelf K1",
"The Stand | King, Stephen | 1978 | Shelf K2",
"It | King, Stephen | 1986 | Shelf K3",
"Misery | King, Stephen | 1987 | Shelf K4",
"Do Androids Dream of Electric Sheep? | Dick, Philip K. | 1968 | Shelf D5",
"I, Robot | Asimov, Isaac | 1950 | Shelf A8",
"Foundation | Asimov, Isaac | 1951 | Shelf A9",
"Dune | Herbert, Frank | 1965 | Shelf H3",
"Neuromancer | Gibson, William | 1984 | Shelf G8",
"Snow Crash | Stephenson, Neal | 1992 | Shelf S6",
"The Martian | Weir, Andy | 2011 | Shelf W5",
"Ender's Game | Card, Orson Scott | 1985 | Shelf C2",
"The Hitchhiker's Guide to the Galaxy | Adams, Douglas | 1979 | Shelf A1",
"Ready Player One | Cline, Ernest | 2011 | Shelf C7",
"The Dark Tower: The Gunslinger | King, Stephen | 1982 | Shelf K5",
// edge cases: missing data
"Unknown Title | | 1975 | Shelf X1",
"Mysterious Manuscript | Unknown Author | | Shelf Z9",
"Ancient Scroll | Anonymous | 850 | ",
];
function parseCard(rawString) {
rawString.split("|");
return [rawString]
}
const cardResult = parseCard(rawCatalogCards[2]);
console.log(cardResult);
```
Your code so far
const rawCatalogCards = [
"From a Buick 8 | King, Stephen | 2002 | Shelf K7",
"The Shining | King, Stephen | 1977 | Shelf K1",
"The Stand | King, Stephen | 1978 | Shelf K2",
"It | King, Stephen | 1986 | Shelf K3",
"Misery | King, Stephen | 1987 | Shelf K4",
"Do Androids Dream of Electric Sheep? | Dick, Philip K. | 1968 | Shelf D5",
"I, Robot | Asimov, Isaac | 1950 | Shelf A8",
"Foundation | Asimov, Isaac | 1951 | Shelf A9",
"Dune | Herbert, Frank | 1965 | Shelf H3",
"Neuromancer | Gibson, William | 1984 | Shelf G8",
"Snow Crash | Stephenson, Neal | 1992 | Shelf S6",
"The Martian | Weir, Andy | 2011 | Shelf W5",
"Ender's Game | Card, Orson Scott | 1985 | Shelf C2",
"The Hitchhiker's Guide to the Galaxy | Adams, Douglas | 1979 | Shelf A1",
"Ready Player One | Cline, Ernest | 2011 | Shelf C7",
"The Dark Tower: The Gunslinger | King, Stephen | 1982 | Shelf K5",
// edge cases: missing data
"Unknown Title | | 1975 | Shelf X1",
"Mysterious Manuscript | Unknown Author | | Shelf Z9",
"Ancient Scroll | Anonymous | 850 | ",
];
function parseCard(rawString) {
// User Editable Region
rawString.split("|");
return [rawString]
// User Editable Region
}
const cardResult = parseCard(rawCatalogCards[2]);
console.log(cardResult);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.4 Safari/605.1.15
Challenge Information:
Build a Heritage Library Catalog - Step 4