File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // WARM UP ROUND
2+ // no function declarations in here
3+ // so only one person "plays" the global frame
4+
5+ let height = 10 ;
6+ let length = 20 ;
7+ let area = height * length ;
8+ console . log ( `area is ${ area } ` ) ;
9+
10+ height += 3 ;
11+ length = length * 5 ;
12+
13+ console . log ( `height is now ${ height } ` ) ;
14+ console . log ( `length is now ${ length } ` ) ;
15+
16+ area = height * length ;
17+ console . log ( `area is ${ area } ` ) ;
Original file line number Diff line number Diff line change 1+ // EXAMPLE 1
2+ // now there is a global frame, and an add frame
3+ // one person will "play" the global frame
4+ // another person will "play" the add frame
5+
6+ function add ( a , b ) {
7+ return a + b ;
8+ }
9+
10+ let x = 10 ;
11+ let y = 32 ;
12+ x = x + 1 ;
13+ y = y - 4 ;
14+ console . log ( "x is " , x ) ;
15+ console . log ( "y is " , y ) ;
16+ console . log ( add ( x , y ) ) ;
Original file line number Diff line number Diff line change 1+ // EXAMPLE 2
2+ // now there will be a global frame, getFirstChar frame, getLastChar frame
3+ // one person will need to "play" one of these frames
4+
5+ const alphabet = "abcdefghijklmnopqrstuvwxyz" ;
6+
7+ function getFirstChar ( str ) {
8+ return str [ 0 ] ;
9+ }
10+
11+ function getLastChar ( str ) {
12+ const lastCharIndex = str . length - 1 ;
13+ return str [ lastCharIndex ] ;
14+ }
15+
16+ const firstChar = getFirstChar ( alphabet ) ;
17+ const lastChar = getLastChar ( alphabet ) ;
18+ console . log ( `The first character in the alphabet is ${ firstChar } ` ) ;
19+ console . log ( `The last character in the alphabet is ${ lastChar } ` ) ;
Original file line number Diff line number Diff line change 1+ // Assign people to the different frames you'll need...
2+
3+ function convertToPercentage ( decimalNumber ) {
4+ const percentage = `${ decimalNumber . toFixed ( 2 ) * 100 } %` ;
5+ return percentage ;
6+ }
7+
8+ function writeRatioWithPercentage ( ratio ) {
9+ const firstPart = Number ( ratio [ 0 ] ) ;
10+ const secondPart = Number ( ratio [ 2 ] ) ;
11+ const allParts = firstPart + secondPart ;
12+
13+ const firstPartPercentage = convertToPercentage ( firstPart / allParts ) ;
14+ const secondPartPercentage = convertToPercentage ( secondPart / allParts ) ;
15+ return `${ firstPartPercentage } : ${ secondPartPercentage } ` ;
16+ }
17+
18+ const input = "2:3" ;
19+ console . log ( writeRatioWithPercentage ( input ) ) ;
You can’t perform that action at this time.
0 commit comments