diff --git a/HTML Notes/jsStructure b/HTML Notes/jsStructure new file mode 100644 index 0000000..41aeadf --- /dev/null +++ b/HTML Notes/jsStructure @@ -0,0 +1,14 @@ +console.log("Here."); + +var button = $("#fetchData"); +var URL = "https://jsonplaceholder.typicode.com/posts"; + +button.click(function() { + $.ajax(URL, {method: "GET", success: function(data){ + for (var i = 0; i < data.length; i++){ + console.log(data[i].title); + var text = $("#data").text(); + $("#data").text(text + data[i].title + "\n"); + } + }}); +}); diff --git a/HTML Notes/structure b/HTML Notes/structure new file mode 100644 index 0000000..7608b28 --- /dev/null +++ b/HTML Notes/structure @@ -0,0 +1,28 @@ + + +*/ + + + + + +

Here we Go.

+ +

+ + + + +/* + +/* +IP: ADDRESS: 192.169.0.5 +TCP: PORT NUMBER: 80, MSG: 1/5 +HTTP: URL, METHOD: GET, HEADERS: - Content-Type: application/csv, application/json, text/html, -Accept: text/html, DATA: 'string' + + +*/ diff --git a/HTML/BlackJack.PNG b/HTML/BlackJack.PNG new file mode 100644 index 0000000..e3722c5 Binary files /dev/null and b/HTML/BlackJack.PNG differ diff --git a/HTML/button.css b/HTML/button.css new file mode 100644 index 0000000..6ebb357 --- /dev/null +++ b/HTML/button.css @@ -0,0 +1,76 @@ +html { + height: 100%; + width: 100%; +} + +body { + margin: 0; + height: 100%; + width: 100%; +} + +#orb { + height: 300px; + width: 300px; + border-radius: 100%; + padding: 20px; + margin: auto; + position: absolute; + top: 0; left: 0; bottom: 0; right: 0; +} + +#sky { + height: 100%; + width: 100%; +} + +.sun { + background-color: #ffdd00; + border: 10px solid #f1c40f; +} +.sun:hover { + border: 20px solid #f1c40f; +} + +.moon { + background-color: #bdc3c7; + border: 10px solid #eaeff2; +} +.moon:hover { + border: 20px solid #eaeff2; +} + +.night { + background-color: #2c3e50; +} +.day { + background-color: #37d8e6; +} + +#moonspot1 { + height: 40px; + width: 40px; + border-radius: 100%; + float:right; + margin: 20px; +} + +#moonspot2 { + height: 80px; + width: 80px; + border-radius: 100%; + float:right; + margin: 20px; +} + +#moonspot3 { + height: 180px; + width: 180px; + border-radius: 100%; + float:right; + margin: 20px; +} + +.visible { + background-color: #eaeff2 +} diff --git a/HTML/button.html b/HTML/button.html new file mode 100644 index 0000000..bde1a41 --- /dev/null +++ b/HTML/button.html @@ -0,0 +1,28 @@ + + +Day and Night + + + + + + + + +
+
+
+
+
+
+ + + + + + + diff --git a/HTML/houston.css b/HTML/houston.css new file mode 100644 index 0000000..852f771 --- /dev/null +++ b/HTML/houston.css @@ -0,0 +1,109 @@ +* { + box-sizing:border-box; +} + +html { + width: 100%; + position:relative; + height: 100%; +} + +body { + margin: 0; + width: 100%; + background-color: #823329; + position:relative; + min-height: 100%; +} + +#banner { + height: 300px; + width: 300px; + border-radius: 100%; + padding: 300px; + margin: auto; + position: absolute; + top: 0; left: 0; bottom: 0; right: 0; +} + +#content { +} + +#content img { + position:absolute; + top: 0px; + right: 0px; + padding: 10px; +} + +.writing { + background-color: #ffdd00; + border: 10px solid #f1c40f; +} +.writing:hover { + border: 20px solid #f1c40f; +} + +.centered { + width: 90%; + position: relative; + padding-top: 200px; + text-align: center; + margin: auto; + padding-bottom: 200px; +} + +#title { + font-family: 'Ubuntu', Arial, Helvetica, sans-serif; + font-size: 50px; + color: #EADEDA; + margin: auto; + border: 20px solid #998888; +} + +#datetime { + font-family: Arial, Helvetica, sans-serif; + color: #EADEDA +} + +#labresults { + color: white; +} + +.text { +margin: auto; +} + +#instrument { + padding-right: 10px; + padding-top: 50px; + margin: auto; + position:relative; + margin-top: 100px; + text-align: center; +} + + +.box { + width: 100px; + height: 100px; + margin-left: 10px; + margin-top: 10px; + position:relative; + text-align: center; + border-radius: 100%; + display: inline-block; +} + +#c { + border-color: #998888; +} + + +#signature { + position: absolute; + bottom: 5px; + right: 5px; + color: white; + font-family: 'Ubuntu', sans-serif; +} diff --git a/HTML/houston.html b/HTML/houston.html new file mode 100644 index 0000000..a6c9e34 --- /dev/null +++ b/HTML/houston.html @@ -0,0 +1,74 @@ + + + + Lab Status + + + + + + + +
Current Date/Time: +
+ +
+
+ + + +
+
Lab Results in REAL Time. +
+ + + +
+ + + +
+ + + +
Powered by BackHack
+ + + + + + + + + + + + + + + + diff --git a/HTML/houston2.html b/HTML/houston2.html new file mode 100644 index 0000000..0cf3414 --- /dev/null +++ b/HTML/houston2.html @@ -0,0 +1,134 @@ + + + + Google Sheets API Quickstart + + + +

Google Sheets API Quickstart

+ + + + + +

+
+    
+
+    
+  
+
diff --git a/HTML/image001.png b/HTML/image001.png
new file mode 100644
index 0000000..8b5910a
Binary files /dev/null and b/HTML/image001.png differ
diff --git a/HTML/index.html b/HTML/index.html
new file mode 100644
index 0000000..65adbbb
--- /dev/null
+++ b/HTML/index.html
@@ -0,0 +1,44 @@
+
+
+Black-Jack-A-Thon!
+  
+
+
+
+  
+ +
+
+
+ + +
+ +
+

Let's Play Some BlackJack!

+ +
+
+ + + +

+ + + + diff --git a/HTML/music.css b/HTML/music.css new file mode 100644 index 0000000..b241921 --- /dev/null +++ b/HTML/music.css @@ -0,0 +1,211 @@ +* { + box-sizing:border-box; +} + +html { + width: 100%; + position:relative; + height: 100%; +} + +body { + margin: 0; + width: 100%; + background-color: #050609; + position:relative; + min-height: 100%; +} + +#banner { + height: 300px; + width: 300px; + border-radius: 100%; + padding: 300px; + margin: auto; + position: absolute; + top: 0; left: 0; bottom: 0; right: 0; +} + +.writing { + background-color: #ffdd00; + border: 10px solid #f1c40f; +} +.writing:hover { + border: 20px solid #f1c40f; +} + +.centered { + width: 100%; + position: relative; + padding-top: 200px; + text-align: center; + margin: auto; + padding-bottom: 200px; +} + +#title { + font-family: Arial, Helvetica, sans-serif; + font-size: 50px; + color: white; + margin: auto; +} + +.text { +margin: auto; +} + +#instrument { + padding-right: 10px; + padding-top: 50px; + margin: auto; + position:relative; + margin-top: 100px; + text-align: center; +} + +.box { + width: 100px; + height: 100px; + margin-left: 10px; + margin-top: 10px; + position:relative; + text-align: center; + border-radius: 100%; + display: inline-block; +} + +#c { + background-color: #3e181b; + border: 3px solid #db1d2d; +} + +#c:hover { + background-color: #661920; + cursor: pointer; +} + +#c:active { + background-color: #db1d2d; +} + +#c2 { + left: 45px; +} + +.letter { + color: white; + text-align: center; + margin-top: 5px; + font-size: 60px; + font-family: comic sans ms; +} + +#d { + background-color: #422018; + border: 3px solid #f0421c; +} +#d:hover { + background-color: #6e2819; + cursor: pointer; +} + +#d:active { + background-color: #f0421c; +} + +#d2 { + left: 159px; +} + +#e { + background-color: #45391b; + border: 3px solid #fec02d; +} +#e:hover { + background-color: #735b20; + cursor: pointer; +} + +#e:active { + background-color: #fec02d; +} + +#e2 { + left: 277px; +} + +#f { + background-color: #193c29; + border: 3px solid #20d071; +} +#f:hover { + background-color: #1b613b; + cursor: pointer; +} + +#f:active { + background-color: #20d071; +} + +#f2 { + left: 394px; +} + +#g { + background-color: #18323e; + border: 3px solid #1a9ddb; +} +#g:hover { + background-color: #184d65; + cursor: pointer; +} + +#g:active { + background-color: #1a9ddb; +} + +#g2 { + left: 508px; +} + +#a { + background-color: #331f35; + border: 3px solid #a13fad; +} +#a:hover { + background-color: #4e2753; + cursor: pointer; +} + +#a:active { + background-color: #a13fad; +} + +#a2 { + left: 622px; +} + +#b { + background-color: #43293d; + border: 3px solid #f26fd4; +} +#b:hover { + background-color: #6f3a62; + cursor: pointer; +} + +#b:active { + background-color: #f26fd4; +} + +#b2 { + left: 742px; +} + +#signature { + position: absolute; + bottom: 5px; + right: 5px; + color: white; + font-family: 'Ubuntu', sans-serif; +} diff --git a/HTML/music.html b/HTML/music.html new file mode 100644 index 0000000..d6fc464 --- /dev/null +++ b/HTML/music.html @@ -0,0 +1,104 @@ + + + + Musical Notes + + + + + + + + + + + + + + +
+
Welcome to Tyler's Singing Voice! +
+ + + +
+
+
C
+
+ +
+
D
+
+ +
+
E
+
+ +
+
F
+
+ +
+
G
+
+ +
+
A
+
+ +
+
B
+
+ +
+ +
+ +
Powered by BackHack
+ + + + + + + + + + + + + + diff --git a/HTML/music_notes/a_note.mp3 b/HTML/music_notes/a_note.mp3 new file mode 100644 index 0000000..b658113 Binary files /dev/null and b/HTML/music_notes/a_note.mp3 differ diff --git a/HTML/music_notes/a_note.ogg b/HTML/music_notes/a_note.ogg new file mode 100644 index 0000000..7aa6f70 Binary files /dev/null and b/HTML/music_notes/a_note.ogg differ diff --git a/HTML/music_notes/a_note.wav b/HTML/music_notes/a_note.wav new file mode 100644 index 0000000..4a8b9f7 Binary files /dev/null and b/HTML/music_notes/a_note.wav differ diff --git a/HTML/music_notes/b_note.mp3 b/HTML/music_notes/b_note.mp3 new file mode 100644 index 0000000..03f5267 Binary files /dev/null and b/HTML/music_notes/b_note.mp3 differ diff --git a/HTML/music_notes/b_note.ogg b/HTML/music_notes/b_note.ogg new file mode 100644 index 0000000..e4f4840 Binary files /dev/null and b/HTML/music_notes/b_note.ogg differ diff --git a/HTML/music_notes/b_note.wav b/HTML/music_notes/b_note.wav new file mode 100644 index 0000000..8ff2c08 Binary files /dev/null and b/HTML/music_notes/b_note.wav differ diff --git a/HTML/music_notes/c_note.mp3 b/HTML/music_notes/c_note.mp3 new file mode 100644 index 0000000..01c83c3 Binary files /dev/null and b/HTML/music_notes/c_note.mp3 differ diff --git a/HTML/music_notes/c_note.ogg b/HTML/music_notes/c_note.ogg new file mode 100644 index 0000000..4bf97ed Binary files /dev/null and b/HTML/music_notes/c_note.ogg differ diff --git a/HTML/music_notes/c_note.wav b/HTML/music_notes/c_note.wav new file mode 100644 index 0000000..b0fc829 Binary files /dev/null and b/HTML/music_notes/c_note.wav differ diff --git a/HTML/music_notes/d_note.mp3 b/HTML/music_notes/d_note.mp3 new file mode 100644 index 0000000..8545b43 Binary files /dev/null and b/HTML/music_notes/d_note.mp3 differ diff --git a/HTML/music_notes/d_note.ogg b/HTML/music_notes/d_note.ogg new file mode 100644 index 0000000..3ef2270 Binary files /dev/null and b/HTML/music_notes/d_note.ogg differ diff --git a/HTML/music_notes/d_note.wav b/HTML/music_notes/d_note.wav new file mode 100644 index 0000000..6200b53 Binary files /dev/null and b/HTML/music_notes/d_note.wav differ diff --git a/HTML/music_notes/e_note.mp3 b/HTML/music_notes/e_note.mp3 new file mode 100644 index 0000000..a9eed15 Binary files /dev/null and b/HTML/music_notes/e_note.mp3 differ diff --git a/HTML/music_notes/e_note.ogg b/HTML/music_notes/e_note.ogg new file mode 100644 index 0000000..7e1c458 Binary files /dev/null and b/HTML/music_notes/e_note.ogg differ diff --git a/HTML/music_notes/e_note.wav b/HTML/music_notes/e_note.wav new file mode 100644 index 0000000..bf5e9b0 Binary files /dev/null and b/HTML/music_notes/e_note.wav differ diff --git a/HTML/music_notes/f_note.mp3 b/HTML/music_notes/f_note.mp3 new file mode 100644 index 0000000..00e3ca8 Binary files /dev/null and b/HTML/music_notes/f_note.mp3 differ diff --git a/HTML/music_notes/f_note.ogg b/HTML/music_notes/f_note.ogg new file mode 100644 index 0000000..117c7a4 Binary files /dev/null and b/HTML/music_notes/f_note.ogg differ diff --git a/HTML/music_notes/f_note.wav b/HTML/music_notes/f_note.wav new file mode 100644 index 0000000..5aaf60f Binary files /dev/null and b/HTML/music_notes/f_note.wav differ diff --git a/HTML/music_notes/g_note.mp3 b/HTML/music_notes/g_note.mp3 new file mode 100644 index 0000000..1a7545d Binary files /dev/null and b/HTML/music_notes/g_note.mp3 differ diff --git a/HTML/music_notes/g_note.ogg b/HTML/music_notes/g_note.ogg new file mode 100644 index 0000000..174efcc Binary files /dev/null and b/HTML/music_notes/g_note.ogg differ diff --git a/HTML/music_notes/g_note.wav b/HTML/music_notes/g_note.wav new file mode 100644 index 0000000..977fe81 Binary files /dev/null and b/HTML/music_notes/g_note.wav differ diff --git a/HTML/music_notes/tyler_a_note.mp3 b/HTML/music_notes/tyler_a_note.mp3 new file mode 100644 index 0000000..c8d27a7 Binary files /dev/null and b/HTML/music_notes/tyler_a_note.mp3 differ diff --git a/HTML/music_notes/tyler_b_note.mp3 b/HTML/music_notes/tyler_b_note.mp3 new file mode 100644 index 0000000..364731d Binary files /dev/null and b/HTML/music_notes/tyler_b_note.mp3 differ diff --git a/HTML/music_notes/tyler_c_note.mp3 b/HTML/music_notes/tyler_c_note.mp3 new file mode 100644 index 0000000..bbb0fa3 Binary files /dev/null and b/HTML/music_notes/tyler_c_note.mp3 differ diff --git a/HTML/music_notes/tyler_d_note.mp3 b/HTML/music_notes/tyler_d_note.mp3 new file mode 100644 index 0000000..45e41f7 Binary files /dev/null and b/HTML/music_notes/tyler_d_note.mp3 differ diff --git a/HTML/music_notes/tyler_e_note.mp3 b/HTML/music_notes/tyler_e_note.mp3 new file mode 100644 index 0000000..35946cb Binary files /dev/null and b/HTML/music_notes/tyler_e_note.mp3 differ diff --git a/HTML/music_notes/tyler_f_note.mp3 b/HTML/music_notes/tyler_f_note.mp3 new file mode 100644 index 0000000..adb6813 Binary files /dev/null and b/HTML/music_notes/tyler_f_note.mp3 differ diff --git a/HTML/music_notes/tyler_g_note.mp3 b/HTML/music_notes/tyler_g_note.mp3 new file mode 100644 index 0000000..be0d265 Binary files /dev/null and b/HTML/music_notes/tyler_g_note.mp3 differ diff --git a/HTML/recursion.html b/HTML/recursion.html new file mode 100644 index 0000000..4f173ca --- /dev/null +++ b/HTML/recursion.html @@ -0,0 +1,44 @@ + + + + + +

Here we Go.

+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/HTML/style.css b/HTML/style.css new file mode 100644 index 0000000..6e02fec --- /dev/null +++ b/HTML/style.css @@ -0,0 +1,106 @@ +* +{ + margin: 0; + padding: 0; +} + +.top +{ + border: 1px solid black; +} + +header +{ + margin-top: 50px; + background-image: url(BlackJack.png); + height: 100vh; + background-size: cover; + background-position: center; +} + +.main-nav +{ + float: left; + list-style: none; + margin-top: 10px; + margin-left: 680px +} + +.main-nav li +{ + display: inline-block; + +} + +.main-nav li a +{ + color: blue; + text-decoration: none; + padding: 5px 20px; + font-family: "Roboto", sans-serif; + font-size: 15px; + border: 1px solid blue; +} + +.main-nav li a:hover +{ + background-color: lightgreen; + transition: all 0.5s ease-in; +} + +.logo img +{ + width: 150px; + height: auto; + float: right; +} + +body +{ + font-family: monospace; +} + +.row +{ + max-width: 2000px; + margin: auto; +} + +.hero +{ + position: static; + border: 3px solid white; +} + +h1 +{ + color: blue; + text-transform: uppercase; + font-size: 70px; + text-align: center; + margin-top: 1000px; +} + +.button +{ + margin-top: 30px; + margin-left: 800px; + margin-bottom: 30px; +} + +.btn +{ + border: 1px solid black; + padding: 10px 30px; + color: black; + text-decoration: none; + margin-right: 5px; + font-size: 13px; + text-transform: uppercase; +} + +.btn:hover +{ + background-color: darkorange; + transition: all 0.5s ease-in; +} diff --git a/arrayForLoops.ts b/arrayForLoops.ts new file mode 100644 index 0000000..df9afd9 --- /dev/null +++ b/arrayForLoops.ts @@ -0,0 +1,12 @@ + + + +var transform = function(arr: Array): number { + var result = 0; + for (var element of arr) { + result += element; + } + return result; +} + +console.log(transform([1, 2, 3, 4, 5])); diff --git a/characterFrequency.ts b/characterFrequency.ts new file mode 100644 index 0000000..71d5492 --- /dev/null +++ b/characterFrequency.ts @@ -0,0 +1,49 @@ +/* + * Write a function that takes as its input a string and returns an array of + * arrays as shown below sorted in descending order by frequency and then by + * ascending order by character. + + 1. + * + * + * :: Example :: + * + * characterFrequency('mississippi') === + * [ + * ['i', 4], + * ['s', 4], + * ['p', 2], + * ['m', 1] + * ] + * + * :: Gotcha :: + * + * characterFrequency('miaaiaaippi') === + * [ + * ['a', 4], + * ['i', 4], + * ['p', 2], + * ['m', 1] + * ] + * + * + */ + +var characterFrequency = function(string: string): Array> { + var result = []; + for (var i = 0; i < string.length; i++) { + var array = []; + array.push(string[i]); + for (var j = 0; j < array.length; j++) { + + } + if (result[i] !== string[i]){ + result.push(string[i]); + } + + result.push(string[i]); + } + return result; +}; + +console.log(characterFrequency('mississippi')); diff --git a/deepEquality.ts b/deepEquality.ts new file mode 100644 index 0000000..97aeb3f --- /dev/null +++ b/deepEquality.ts @@ -0,0 +1,24 @@ +/** +The == operator compares objects by identity. But sometimes you’d prefer to compare the values of their actual properties. + +Write a function deepEqual that takes two values and returns true only if they are the same value or are objects with the same properties, where the values of the properties +are equal when compared with a recursive call to deepEqual. + +To find out whether values should be compared directly (use the === operator for that) or have their properties compared, you can use the typeof operator. If it produces + "object" for both values, you should do a deep comparison. But you have to take one silly exception into account: because of a + historical accident, typeof null also produces "object". + +The Object.keys function will be useful when you need to go over the properties of objects to compare them. + */ +var deepEqual = function(apple: Array>, orange: number): boolean { + +}; + + +var obj = {here: {is: "an"}, object: 2}; +console.log(deepEqual(obj, obj)); +// → true +console.log(deepEqual(obj, {here: 1, object: 2})); +// → false +console.log(deepEqual(obj, {here: {is: "an"}, object: 2})); +// → true diff --git a/newpascal.ts b/newpascal.ts new file mode 100644 index 0000000..7c8286f --- /dev/null +++ b/newpascal.ts @@ -0,0 +1,31 @@ +//Create a generateTriangle function that generates a triangle with ones in all positions such as +//> input: `generateTriangle(3)` +//> output: `[[1], [1, 1], [1, 1, 1]]` + +var generateTriangle = function(numRows: number): Array> { + var final = []; + //loop through creating rows + for (var i = 0; i < numRows; i++) { + var result = []; + result.push(1); + final.push(result); + //loop through to create triangle + for (var j = 0; j < i; j++) { + if (i === 0){ + result.push(1); + } + if (i === 1){ + result.push(1); + } + if (i === j){ + result.push(1); + } else if (i > 1 && j > 0){ + var inner = final[i-1][j-1] + final[i-1][j]; + console.log(inner); + result.push(inner); + } + }; + }; + return final; +}; +console.log(generateTriangle(4)); diff --git a/objectLesson.ts b/objectLesson.ts new file mode 100644 index 0000000..43dfc3a --- /dev/null +++ b/objectLesson.ts @@ -0,0 +1,43 @@ +/*Write a function arrayToList that builds up a list structure like the one +shown when given [1, 2, 3] as argument. + +Also write a listToArray function that +produces an array from a list. + +Then add a helper function prepend, which takes +an element and a list and creates a new list that adds the element to the front + of the input list, + + and nth, which takes a list and a number and returns the + element at the given position in the list (with zero referring to the first + element) or undefined when there is no such element. + */ + +var arr = [1, 2, 3]; +type ListNode = {value: number | string, next: ListNode | null} | null; +var list = {value: 1, next:{value: 2, next:{value: 3, next: null}}}; + +var arrayToList = function(arr: Array): ListNode { + var firstNode = null; + + for(var position of arr) { + if (firstNode === null) { + firstNode = {value: position, next: null}; + } else { + console.log('firstNode'); + console.log(firstNode); + var newNode = {value: position, next: null}; + var currentNode = firstNode; + while (currentNode.next !== null) { + console.log('currentNode'); + console.log(currentNode); + currentNode = currentNode.next; + } + currentNode.next = newNode; + } + }; + return firstNode; +}; +var solution = arrayToList([1, 2, 3, 4, 5]); + +console.log(JSON.stringify(solution.next.next, null, '\t')); diff --git a/pascal.ts b/pascal.ts new file mode 100644 index 0000000..55cc846 --- /dev/null +++ b/pascal.ts @@ -0,0 +1,44 @@ +//Pascals Triangle +// 1. input # of rows +// 2. output a pascal triangle + +var numberRows = 3; +var inner = []; +var totalArray = []; +var parentSum = 0; +// loops through printing each row +for (var i = 0; i < numberRows; i++) { + inner.push(1); + //console.log(inner); + + for (var j = 0; j < numberRows - 1; j++) { + if(j = 0){ + break; + } + if(j = numberRows - 1){ + break; + } + parentSum = inner[i+1] + inner[j]; + console.log(parentSum); + } + inner.push(parentSum); + totalArray.push(inner); +} + +//console.log(totalArray); + +// if numberRows = 1, expect [1] +// if numberRows = 3, expect [1] +// [1][1] +// [1][2][1] +// [[1], +// [1,1], +// [1,2,1], +// [1,3,3,1], +// [1,4,6,4,1] ] + +// if i = 2, j = 1; parent1: i=1, j=0, parent2 = i=1, j=1; +// if i = 3, j = 1; parent1: i=2, j=0, parent2 = i=2, j=1; +// if i = 4, j = 2; parent1: i=3, j=1, parent2 = i=3, j=2; + +// triangle[3][2] diff --git a/powerOfTwo.ts b/powerOfTwo.ts new file mode 100644 index 0000000..c8bd89c --- /dev/null +++ b/powerOfTwo.ts @@ -0,0 +1,20 @@ +/** + * Write a function that accepts a number `n` as its input and returns a boolean + * value representing whether or not `n` is a power of 2. + * + * If your answer is iterative, try solving it using recursion (and vice versa). + * Once you've solved the problem both ways, see if you can devise a clever way + * of solving the problem using bitwise operators. + */ + + var isPowerOfTwo = function(n: number): boolean { + if (n === 2){ + return true; + } else if (n < 2){ + return false; + } else { + return isPowerOfTwo(n / 2); + } + }; + + console.log(isPowerOfTwo(32)); diff --git a/reversestring.ts b/reversestring.ts new file mode 100644 index 0000000..a542b6a --- /dev/null +++ b/reversestring.ts @@ -0,0 +1,11 @@ +var reverseString = function(d: string): string { + var result = ""; + for (var i = 0; i < d.length; i++) { + var initial = d[i]; + initial = d[d.length - (i + 1)]; + result += initial; + } + return result; +}; + +console.log(reverseString("Tyler")); diff --git a/toLowerCase.ts b/toLowerCase.ts new file mode 100644 index 0000000..f06deac --- /dev/null +++ b/toLowerCase.ts @@ -0,0 +1,6 @@ +var toLowerCase = function(str: string) { + if (str === null || str === ""){ + return null; + } + +} diff --git a/twosum.ts b/twosum.ts deleted file mode 100644 index f92d7c6..0000000 --- a/twosum.ts +++ /dev/null @@ -1,10 +0,0 @@ -//Given an array of integers, return indices of the two numbers such that they add up to a specific target. - -//You may assume that each input would have exactly one solution, and you may not use the same element twice. - - -//EXAMPLE -//Given nums = [2, 7, 11, 15], target = 9, - -//Because nums[0] + nums[1] = 2 + 7 = 9, -//return [0, 1].