From 16fc6fb74832292847cac6140ad4081a3b4269da Mon Sep 17 00:00:00 2001 From: Ani7991 <56262665+Ani7991@users.noreply.github.com> Date: Fri, 11 Oct 2019 19:07:49 +0400 Subject: [PATCH 1/8] Update README.md --- README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/README.md b/README.md index bb9071e..648856a 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,78 @@ Please fork add your solution then open pull request. Good luck! + + + +//1__________________________ +// var arr=[]; +// var n=0;; +// var m=0; + +// function sorT(arr){ + +// for(var i=0; in) +// newarray.push(arr[i]); +// } +// return newarray; +// } +// console.log(larger([1,5,4,6,8,9,10],7)); +//4_________________________________________________________ + + + + + + + + + + + + + + +//5________________________________________________ +// var arr=[]; +// function rotate(arr,n){ +// return arr.splice(n,arr.length).concat(arr.splice(0,n)); + +// } +// console.log(rotate([1,2,3,4,5,6],2)); + From 8cb0f1786ef08ccbdabce54a812ad13086d84e3c Mon Sep 17 00:00:00 2001 From: Ani7991 <56262665+Ani7991@users.noreply.github.com> Date: Fri, 11 Oct 2019 19:09:37 +0400 Subject: [PATCH 2/8] Update README.md --- README.md | 98 +++++++++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 648856a..5554ac9 100644 --- a/README.md +++ b/README.md @@ -5,56 +5,56 @@ Good luck! -//1__________________________ -// var arr=[]; -// var n=0;; -// var m=0; +1__________________________ + var arr=[]; +var n=0;; + var m=0; -// function sorT(arr){ + function sorT(arr){ -// for(var i=0; in) + newarray.push(arr[i]); + } + return newarray; + } + console.log(larger([1,5,4,6,8,9,10],7)); +4_________________________________________________________ -// function larger(arr,n){ -// for(var i=0; i< arr.length;i++){ -// if(arr[i]>n) -// newarray.push(arr[i]); -// } -// return newarray; -// } -// console.log(larger([1,5,4,6,8,9,10],7)); -//4_________________________________________________________ @@ -68,12 +68,10 @@ Good luck! - -//5________________________________________________ -// var arr=[]; -// function rotate(arr,n){ -// return arr.splice(n,arr.length).concat(arr.splice(0,n)); - -// } -// console.log(rotate([1,2,3,4,5,6],2)); +5________________________________________________ + var arr=[]; + function rotate(arr,n){ + return arr.splice(n,arr.length).concat(arr.splice(0,n)); + } + console.log(rotate([1,2,3,4,5,6],2)); From 27950bfa7425f9524154f73b0c5f3728c821fce8 Mon Sep 17 00:00:00 2001 From: Ani7991 <56262665+Ani7991@users.noreply.github.com> Date: Fri, 11 Oct 2019 19:10:12 +0400 Subject: [PATCH 3/8] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5554ac9..704601f 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ Good luck! -1__________________________ - var arr=[]; +1______________ + +var arr=[]; var n=0;; var m=0; From ff9d49ae0370b4fd4917f7cc9fae85313efe185f Mon Sep 17 00:00:00 2001 From: Ani7991 <56262665+Ani7991@users.noreply.github.com> Date: Fri, 11 Oct 2019 19:10:35 +0400 Subject: [PATCH 4/8] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 704601f..39fd62a 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ console.log(sorT([1,"10","hi",9])); console.log(longestW("London is a capital of The Great Britain")); 3_____________________________________________________ + var arr=[]; var newarray=[]; function larger(arr,n){ @@ -70,6 +71,7 @@ function larger(arr,n){ 5________________________________________________ + var arr=[]; function rotate(arr,n){ return arr.splice(n,arr.length).concat(arr.splice(0,n)); From 2786bb104fb2007750c2b5fc65725bd74cd1d178 Mon Sep 17 00:00:00 2001 From: Ani7991 <56262665+Ani7991@users.noreply.github.com> Date: Fri, 11 Oct 2019 19:12:16 +0400 Subject: [PATCH 5/8] Update README.md --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 39fd62a..3a327e8 100644 --- a/README.md +++ b/README.md @@ -29,31 +29,51 @@ console.log(sorT([1,"10","hi",9])); 2__________________________________________________ function longestW (str){ + let word=""; + var str=String(str); + var arr=Array(arr); + var arr= str.trim().split(" "); + for(var i=0;in) + newarray.push(arr[i]); + } + return newarray; + } + console.log(larger([1,5,4,6,8,9,10],7)); 4_________________________________________________________ @@ -73,8 +93,11 @@ function larger(arr,n){ 5________________________________________________ var arr=[]; + function rotate(arr,n){ + return arr.splice(n,arr.length).concat(arr.splice(0,n)); } + console.log(rotate([1,2,3,4,5,6],2)); From 4966b816632421cb437aaf7bda280ad2b05787fc Mon Sep 17 00:00:00 2001 From: Ani7991 <56262665+Ani7991@users.noreply.github.com> Date: Mon, 14 Oct 2019 00:25:27 +0400 Subject: [PATCH 6/8] Done! --- README.md | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3a327e8..52dc186 100644 --- a/README.md +++ b/README.md @@ -77,16 +77,33 @@ function larger(arr,n){ console.log(larger([1,5,4,6,8,9,10],7)); 4_________________________________________________________ +function convert(num) { + if (num == 0 ) return "zero"; + else if( num> 999) + return "Too big"; + else return convert_hundreds(num); +} +var ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']; +var tens = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']; +var teens = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']; +function convert_hundreds(num) { + if (num > 99) { + return ones[Math.floor(num / 100)] + " hundred " + convert_tens(num % 100); + } else { + return convert_tens(num); + } +} - - - - - - - +function convert_tens(num) { + if (num < 10) return ones[num]; + else if (num >= 10 && num < 20) return teens[num - 10]; + else { + return tens[Math.floor(num / 10)] + " " + ones[num % 10]; + } +} +console.log(convert(28)); From e05ff2785133a074efe361c27b97ce75b4917b85 Mon Sep 17 00:00:00 2001 From: Ani7991 <56262665+Ani7991@users.noreply.github.com> Date: Mon, 14 Oct 2019 00:28:51 +0400 Subject: [PATCH 7/8] Update README.md --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52dc186..0eead91 100644 --- a/README.md +++ b/README.md @@ -77,36 +77,60 @@ function larger(arr,n){ console.log(larger([1,5,4,6,8,9,10],7)); 4_________________________________________________________ + function convert(num) { + if (num == 0 ) return "zero"; + else if( num> 999) + return "Too big"; + else return convert_hundreds(num); + } + var ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']; + var tens = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']; + var teens = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']; + function convert_hundreds(num) { + if (num > 99) { + return ones[Math.floor(num / 100)] + " hundred " + convert_tens(num % 100); + } else { + return convert_tens(num); + } + } function convert_tens(num) { + if (num < 10) return ones[num]; + + else if (num >= 10 && num < 20) return teens[num - 10]; + + else { - return tens[Math.floor(num / 10)] + " " + ones[num % 10]; - } + + return tens[Math.floor(num / 10)] + " " + ones[num % 10];} } + + console.log(convert(28)); + 5________________________________________________ var arr=[]; From 0ad9f53c9f5f642809d35ea56b68e37aa893bc06 Mon Sep 17 00:00:00 2001 From: Ani7991 <56262665+Ani7991@users.noreply.github.com> Date: Mon, 14 Oct 2019 16:25:00 +0400 Subject: [PATCH 8/8] Update README.md --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 0eead91..db607c9 100644 --- a/README.md +++ b/README.md @@ -8,22 +8,49 @@ Good luck! 1______________ var arr=[]; -var n=0;; - var m=0; - - function sorT(arr){ +function sorT(arr){ + let n=0; + let m=0; for(var i=0; i { + + + if( typeof(elm) == 'number' ){ + + n++; + } + + else if (typeof(elm) == 'string'){ + + m++; + + }}); + +return "Numbers :" + n + " " + "Strings :" + m; + +} +console.log(sorT([1,"10","hi",9])); 2__________________________________________________ @@ -41,10 +68,11 @@ console.log(sorT([1,"10","hi",9])); for(var i=0;in) + if(arr[i]>n){ newarray.push(arr[i]); - + } } return newarray; @@ -80,12 +108,13 @@ function larger(arr,n){ function convert(num) { - if (num == 0 ) return "zero"; - - else if( num> 999) + if (num == 0 ) { + return "zero"; + } + else if( num> 999){ return "Too big"; - + } else return convert_hundreds(num); }