Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Add] : seminar1 level1 #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions seminar_1/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions seminar_1/javascript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
var variable1 = "var variable";
var variable1 = "new var variable";

console.log("var: ", variable1);

let variable2 = "let variable";

console.log("let: ", variable2);

const variable3 = "const variable";
const variable3 = "new const variable";

console.log("const: ", variable3);

var variable1 = "var variable";
variable1 = "new variable";

console.log("var: ", variable1);

let variable2 = "let variable";
variable2 = "new variable";

console.log("let: ", variable2);

const variable3 = "const variable";
// variable3 = "new variable"; //error

if (true) {
var x = "var";
}

console.log(`var: ${x}`); // function scope

if (true) {
let y = "let";
}

// console.log(`let: ${y}`); // error y is block scope

function foo() {
if (true) {
var variable = "hello";
console.log(`if block - `, variable);
}
console.log(`function block - ${variable}`);
}

// console.log(`global - ${variable}`) // error variable is no define

let numArr = [1, 2, 3];
const newArr = numArr.map((x) => x * 2);

console.log(newArr);

const sopt = {
season: 30,
group: ["YB", "OB"],
part: ["server", "plan", "design", "android", "ios", "web"],
president: "김규민",
introduce: function () {
this.part.map((name) => {
console.log(`솝트 내 파트는 ${name} 파트가 있어요.`);
});
},
};

let arr = [1, "item", true];
let arr2 = Array(4, null, { item: "item" });

arr.map((item) => console.log(item));
arr2.map((item) => console.log(item));

function sum(a, b) {
return a + b;
}

let sum = (a, b) => {
return a + b;
};
117 changes: 117 additions & 0 deletions seminar_1/typescript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
let isDone: boolean = true;
const str: string = "hello";

let num: number = 2;
// const sum:number = 'sum number' // error not assignable

let arr: number[] = [1, 2, 3];
const strArr: Array<string> = ["hello", "world"];
const objArr: Array<object> = [{ item: "val1" }, { item: "val2" }];

const foo = (obj: object): void => {
console.log(obj);
};

const boo = (obj: Object): void => {
console.log(obj);
};

// foo('hi'); // error not assignable
boo("hi");

function foo2(a: number, b: number): number {
return a + b;
}

const boo2 = (a: number, b: number): number => {
return a + b;
};

let a: null = null;
// let x: null = 2; // errror not assignable

let b: undefined = undefined;
let y: undefined = null; // not assignable

let myName: any = "gunmo";
let myNameLength: number = (<string>myName).length;

let yourName: any = "you";
let yourNameLength: number = (yourName as string).length;

const unknown: any = {
name: "gunmo",
age: 30,
organization: "sopt",
completion: [29, 30],
};

interface Sopt {
name: string;
age: number;
organization: string;
completion: number[];
}

const sopt: Sopt = {
name: "gunmo",
age: 30,
organization: "sopt",
completion: [29, 30],
};

const sopts: Sopt[] = [
{
name: "gunmo",
age: 30,
organization: "sopt",
completion: [29, 30],
},
{
name: "gunmo",
age: 30,
organization: "sopt",
completion: [29, 30],
},
{
name: "gunmo",
age: 30,
organization: "sopt",
completion: [29, 30],
},
];

interface Closet {
name: string;
shirt: number;
pants: number;
sunglass?: number;
hat?: number;
}

const ohmygirl: Array<Closet> = [
{
name: "hyo",
shirt: 5,
pants: 2,
},
{
name: "ye",
shirt: 3,
pants: 5,
sunglass: 4,
},
];

function greet() {
return "hello";
}

function timer() {
return setTimeout(() => {
return "End";
}, 3000);
}

greet();
timer();