Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
closing as this is not specific to this kata and would require a systematic update of JavaScript content on Codewars
Approved by someone
It only seems to work on node 8
TS Translation
It's because parseInt takes 2 parameters and I forgot that. I fixed it now.
This is my fault. I forgot that parseInt takes a second parameter which completely changes the behavior. It should be fixed now.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
A'ight, this kata has me thrown for a loop. There are some tests that appear that yield one result on the master test, but seem as though they should fail the problem as described. It seems to come down to how Array.prototype.some behaves when handed parseInt?
For example, one generated test:
seq = [
'JDQIAXYXUNBLWRAJSFXT',
'D',
'WCPXZDEGMLCRZ',
'UYJMHZ',
'XBIHTBFUBBNZLOXRGFFABJKJFPI',
'TCNIIHVBFLOVXYG',
'PNPOTCZUPVFVWGTL',
'Z',
'XGINIHEGSOEYMRASCEKRZ',
'',
'',
'JDMJVCRJUGMXWN',
'PMIJJEJKMIBB',
'FXU',
'PYPSHQLTROEUN',
'KICOX',
'GERISTWQWDGAFERQIIFXVGJ',
'YWLJCSNAMZGLOXJLNLGHKVNDTEPY',
'CQLIUPVRSMVTHQSCJJC',
'XWBQHOSFAFI',
'FA',
'BIMKRIOHZCAG',
'BMDBPDDHONJOAOVUIWHGFDO',
'CMWFHNYFQQNWPBNNKSCDFDIRB',
'AGCWIZYRHQCGQPYEGKIES',
'TRAGUVGYJ',
'LSJSLBF',
'BLIQUGELZDQ',
'AHOORDONNUQBYDDVI',
'EDU',
'SVALRMLJGV',
'DFFLUMEJHIP',
'YNUUEJN',
'CNTYKGQRFWLHTB',
'YO',
'EFMVKHWLVMEJSZWW',
'QKDWFTLQFBBCDUUAOIAV',
'XBWSBFBAZIPPBWBJYTT',
'',
'SONQBBCCBBDMGD',
'PYNLTD',
'JUTSGTDJUZPFNCXJHICNWMH',
'',
'DC',
'CUZST',
'KSGPQILMASPYLDRSDJNCAI',
'SKPYFUXQYLUQFDZYE',
'LOZQUNTQMSGRR',
'TBWPDTYBMLJSMVFPWNKNAQHMKUA',
'AENVOGUUJNJRYHSQVFZ',
'GIJRVCRRHGNDQWTXOGCA',
'YZNO',
'SCPMMBOFEFTIRAAKNBSH',
'CPQNNP'
]
pred = parseInt
And the output of using this sequence is:
seq.every(parseInt) == false
seq.some(parseInt) == true
seq.some(x=>parseInt(x)) == false
So a solution that runs
seq.some(pred)
will get a different result than one that runsseq.some(x=>pred(x))
or something to the effect oflet trueSeen = false;
for(const x of seq) if(pred(x)) trueSeen=true;
return trueSeen
will also return false.
Just at a glance, I'd expect false (every one of those strings yields NaN), yet the built in tools yield true.
Can anyone tell me what I'm missing?
Seems a bit harder than 7kyu
JS translation
Lua translation!
Going for better UX by minimizing the number of clicks. Plus some of the examples at the top of the collection are bad groovy translations of mine.
Your link goes a bit too deep, maybe it would be just https://www.codewars.com/kata/526c7363236867513f0005ca/groovy or a link to the whole collection.
β
Loading more items...