Created
October 22, 2013 18:50
-
-
Save Sequoia/7106020 to your computer and use it in GitHub Desktop.
It looks to me like there are **nine lines**, not eight. What am I missing?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h2.Code | |
```javascript | |
var fs = require('fs'); | |
var filename = process.argv[2]; | |
var fileBuffer = fs.readFileSync(filename); | |
//get # of lines in `contents` Buffer | |
var lines = fileBuffer.toString().split("\n"); | |
lines.forEach(function(line,index){//remove \r's | |
lines[index] = line.replace(/\r/,''); | |
}); | |
lines = lines.filter(function(elem){ //cast out empty lines | |
return elem.length > 0; | |
}) | |
lines.forEach(function(line, index){ | |
console.log(">>>>>>>line " + (index+1) + "<<<<<<<<"); | |
console.log(line); | |
console.log("^^^End line " + (index+1) + " ^^^"); | |
}); | |
//console.log(filename); | |
console.log(lines.length); | |
``` | |
h2.Output | |
``` | |
D:\Users\smcdowell\learnyounode> learnyounode verify .\firstio.js | |
Verifying "MY FIRST I/O!"... | |
ACTUAL EXPECTED | |
------ -------- | |
">>>>>>>line 1<<<<<<<<" != "8" | |
"Stands out like a bog standard and get a dog up ya schooner. As stands out like daks mate he hasn't got a ace!. He's got a massive sanger how shazza got us some corker. Watch out for the dag flamin s | |
hazza got us some gobsmacked. Stands out like a bonza mate grab us a cut snake. We're going blow in the bag and mad as a veg out. It'll be not my bowl of rice when get a dog up ya bunyip. She'll be ri | |
ght quid no worries built like a tinny." != "" | |
"^^^End line 1 ^^^" != null | |
">>>>>>>line 2<<<<<<<<" != null | |
"He hasn't got a cut snake heaps flat out like a slab. Lets get some chunder no dramas we're going rapt. As cross as a battler flamin as cross as a back of bourke. Mad as a bities and watch out for th | |
e mickey mouse mate. Mad as a aussie rules footy how she'll be right big smoke. Stands out like a sickie no dramas you little ripper sheila. He hasn't got a battler no dramas gutful of booze bus." != | |
null | |
"^^^End line 2 ^^^" != null | |
">>>>>>>line 3<<<<<<<<" != null | |
"Flat out like a cactus mate piece of piss trent from punchy g'day. Stands out like a brizzie piece of piss as dry as a fisho. You little ripper billy where we're going cockie. Trent from punchy cut l | |
unch no dramas as cunning as a hit the turps. Gutful of chuck a sickie to built like a wuss. Come a chewie heaps lets throw a bounce." != null | |
"^^^End line 3 ^^^" != null | |
">>>>>>>line 4<<<<<<<<" != null | |
"As cross as a mickey mouse mate also we're going his blood's worth bottling. Gutful of fairy floss heaps trent from punchy blue. As cross as a piker bloody as dry as a fly wire. Come a butcher mate h | |
e hasn't got a skite. As stands out like fairy floss when as busy as a fly wire. Get a dog up ya spag bol heaps as cunning as a ambo." != null | |
"^^^End line 4 ^^^" != null | |
">>>>>>>line 5<<<<<<<<" != null | |
"As busy as a dog's balls mate he hasn't got a snag. As stands out like brizzie heaps as busy as a dag. Come a your shout mate as dry as a dinky-di. Shazza got us some squizz with as cross as a dog's | |
balls. Lets throw a waratah piece of piss watch out for the yobbo. As dry as a compo flamin it'll be galah. Built like a maccas piece of piss built like a galah. As cunning as a durry no worries as cu | |
nning as a hooroo. Flat out like a turps no worries watch out for the yabber." != null | |
"^^^End line 5 ^^^" != null | |
">>>>>>>line 6<<<<<<<<" != null | |
"As cross as a rock up mate come a parma. Gutful of bounce bloody it'll be fair dinkum. Come a mickey mouse mate where flat out like a turps. As cross as a cark it mate lets get some servo. Watch out | |
for the bizzo where built like a dunny. As busy as a buck's night flamin come a slabs." != null | |
"^^^End line 6 ^^^" != null | |
">>>>>>>line 7<<<<<<<<" != null | |
"Gutful of fly wire where get a dog up ya brickie. Lets get some bush oyster where gutful of aussie salute. Lets get some ridgy-didge bloody lets get some dog's balls. Built like a pash piece of piss | |
as cross as a dipstick. Lets get some blowie heaps it'll be tinny. It'll be fair go and as cross as a rotten." != null | |
"^^^End line 7 ^^^" != null | |
">>>>>>>line 8<<<<<<<<" != null | |
"You little ripper paddock bloody he's got a massive wuss. As cunning as a fossicker with as busy as a bogan. Stands out like a blowie no worries mad as a bludger. We're going kelpie to he's got a mas | |
sive grundies. Trent from punchy sunnies mate trent from punchy sheila. She'll be right butcher also flat out like a good oil. It'll be dero also flat out like a cockie. We're going dill no dramas she | |
'll be right cut lunch commando." != null | |
"^^^End line 8 ^^^" != null | |
">>>>>>>line 9<<<<<<<<" != null | |
"It'll be bail up with get a dog up ya whinge. As stands out like yakka flamin stands out like a franger. It'll be spag bol also as cunning as a holy dooley!. As cross as a cobber to she'll be right o | |
p shop. As cunning as a bluey and get a dog up ya dog's balls. As cunning as a galah flamin lets get some chook. It'll be rotten and he's got a massive blowie. Built like a whinge when watch out for t | |
he swagger. Stands out like a dunny piece of piss come a banana bender." != null | |
"^^^End line 9 ^^^" != null | |
"9" != null | |
"" != null | |
# FAIL | |
Your solution to MY FIRST I/O! didn't pass. Try again! | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment