-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var message = "Hello, TypeScript"; | ||
console.log(message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let message: string = "Hello, TypeScript"; | ||
console.log(message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var message = "Hello, World"; | ||
function printChars(s) { | ||
for (var i = 0; i < s.length; i++) { | ||
console.log(s[i]); | ||
} | ||
} | ||
function printVowels(s) { | ||
var vowels; | ||
(function (vowels) { | ||
vowels[vowels["a"] = 0] = "a"; | ||
vowels[vowels["e"] = 1] = "e"; | ||
vowels[vowels["i"] = 2] = "i"; | ||
vowels[vowels["o"] = 3] = "o"; | ||
vowels[vowels["u"] = 4] = "u"; | ||
})(vowels || (vowels = {})); | ||
; | ||
for (var i = 0; i < s.length; i++) { | ||
if (s[i] in vowels) { | ||
console.log(s[i]); | ||
} | ||
} | ||
} | ||
function getProduct() { | ||
var nums = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
nums[_i] = arguments[_i]; | ||
} | ||
var total = 1; | ||
nums.forEach(function (num) { | ||
total *= num; | ||
}); | ||
return total; | ||
} | ||
console.log(getProduct(2, 2)); | ||
console.log(getProduct(2, 4)); | ||
console.log(getProduct(3, 3, 3, 3, 3)); | ||
console.log("Characters in Message: "); | ||
printChars(message); | ||
console.log("Vowels in Message: "); | ||
printVowels(message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
let message: string = "Hello, World"; | ||
|
||
function printChars(s: string): void { | ||
for (let i = 0; i < s.length; i++) { | ||
console.log(s[i]); | ||
} | ||
} | ||
|
||
function printVowels(s: string): void { | ||
enum vowels { | ||
'a', | ||
'e', | ||
'i', | ||
'o', | ||
'u', | ||
}; | ||
|
||
for (let i = 0; i < s.length; i++) { | ||
if (s[i] in vowels) { | ||
console.log(s[i]); | ||
} | ||
} | ||
} | ||
|
||
function getProduct(...nums: number[]): number { | ||
let total: number = 1; | ||
|
||
nums.forEach(num => { | ||
total *= num; | ||
}); | ||
|
||
return total; | ||
} | ||
|
||
console.log(getProduct(2, 2)); | ||
console.log(getProduct(2, 4)); | ||
console.log(getProduct(3,3,3,3,3)); | ||
|
||
console.log("Characters in Message: "); | ||
printChars(message); | ||
|
||
console.log("Vowels in Message: "); | ||
printVowels(message); |