scrimba
Note at 1:05
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Note at 1:05
AboutCommentsNotes
Note at 1:05
Expand for more info
main.js
run
preview
console
alphabetSubsequence=s=>!(s.split('').some((c,i,a)=>i&&c<=a[i-1]))
////////10////////20////////30////////40////////50////////60////////70////////80////////90///////100

// [DAY 19] score: 65

/*
** javascriptmas golf rules:
** - the original test suite must pass and not be modified
** - the solution must generally work (edge cases aren't important unless stated in the problem)
** - each character in the code above counts as a stroke (including whitespace)
** - lowest score wins
*/

/**
* Test Suite
*/
describe('alphabetSubsequence()', () => {
it('returns false when it has duplicate letters', () => {
// arrange
const str = 'effg';

// act
const result = alphabetSubsequence(str);

// log
console.log("result 1: ", result);

// assert
expect(result).toBe(false);
});

it('returns false when NOT in ascending a - z order', () => {
// arrange
const str = 'cdce';

// act
const result = alphabetSubsequence(str);

// log
console.log("result 2: ", result);

// assert
expect(result).toBe(false);
});

it('returns true whenno duplicates and is ascending a - z order ', () => {
// arrange
const str = 'ace';

// act
const result = alphabetSubsequence(str);

// log
console.log("result 3: ", result);

// assert
expect(result).toBe(true);
});
});
Console
"result 1: "
,
false
,
"result 3: "
,
true
,
"result 2: "
,
false
,
/index.html
LIVE