File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
js-core/classworks/classwork-5/src Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -61,9 +61,9 @@ const task1 = function(data, number) {
6161 let dataElem = data [ key ] ;
6262 if ( Array . isArray ( dataElem ) ) {
6363 for ( let i = 0 ; i < dataElem . length ; i ++ ) {
64- let elem2 = dataElem [ i ] ;
65- if ( number < elem2 ) {
66- console . log ( elem2 ) ;
64+ let elem = dataElem [ i ] ;
65+ if ( number < elem ) {
66+ console . log ( elem ) ;
6767 break ;
6868 }
6969 }
@@ -76,10 +76,15 @@ task1(obj, 200);
7676task1 ( arr , 55 ) ;
7777
7878
79-
79+ //reverse string
8080
8181const myString = 'JavaScript is Awesome' ;
82- const myStringInArray = myString . split ( ' ' ) ;
83- myStringInArray . reverse ( ) ;
84- const myStringJoin = myStringInArray . join ( ' ' ) ;
85- console . log ( ) ;
82+
83+ function reverseString ( str ) {
84+ var newString = "" ;
85+ for ( var i = str . length - 1 ; i >= 0 ; i -- ) {
86+ newString += str [ i ] ;
87+ }
88+ return newString ;
89+ }
90+ console . log ( reverseString ( myString ) ) ;
You can’t perform that action at this time.
0 commit comments