diff --git a/public/sandbox.js b/public/sandbox.js index 6a0850d..42a3923 100644 --- a/public/sandbox.js +++ b/public/sandbox.js @@ -1,19 +1,7 @@ "use strict"; -// let greet: Function = () => { -// console.log('hello, world'); -// } -// greet = 'hello'; -// greet = () => { -// console.log('hello, again'); -// } -var add = function (a, b, c /*?*/) { - if (c === void 0) { c /*?*/ = 10; } - console.log(a + b); - console.log(c); +var logDetails = function (uid, item) { + console.log(item + " has a uid of " + uid); }; -add(5, 10, 'ninja'); -var minus = function (a, b) { - return a + b; +var greet = function (user) { + console.log(user.name + " says hello"); }; -var result = minus(10, 7); -console.log(result); diff --git a/src/sandbox.ts b/src/sandbox.ts index 534d3b8..2f95ac9 100644 --- a/src/sandbox.ts +++ b/src/sandbox.ts @@ -1,23 +1,7 @@ -// let greet: Function = () => { -// console.log('hello, world'); -// } - -// greet = 'hello'; - -// greet = () => { -// console.log('hello, again'); -// } - -const add = (a: number, b: number, c/*?*/: number | string = 10): void => { - console.log(a + b); - console.log(c); -} - -add(5, 10, 'ninja'); - -const minus = (a: number, b: number): number => { - return a + b; +const logDetails = (uid: string | number, item: string) => { + console.log(`${item} has a uid of ${uid}`); } -let result = minus(10,7); -console.log(result); \ No newline at end of file +const greet = (user: {name: string, uid: string | number}) => { + console.log(`${user.name} says hello`); +} \ No newline at end of file