Skip to content
Snippets Groups Projects
Commit 64bbcf86 authored by SWIATOKA Maximilien's avatar SWIATOKA Maximilien
Browse files

Replace td_debug.ts

parent 1c572aa1
Branches
No related tags found
No related merge requests found
//exercice1/2
function deb1(): number {
let j = 200;
let tab = [];
for (let i = 0; i < 10; i++) {
j -= 10;
tab[i] = j;
}
return j;
}
//console.log(deb1());
//exercice3
function deb2(x: number, y: number): void {
const tmp = y;
y = x;
x = tmp;
//console.log(x, y);
}
let x = 10;
let y = 10;
deb2(x, y);
//console.log(x, y);
//exercice 4
function deb3(xy: number[]): void {
let tmp = xy[0];
xy[0] = xy[1];
xy[1] = tmp;
console.log(xy);
}
let xy = [10, 20];
deb3(xy);
console.log(xy);
// //exercice1/2
// function deb1(): number {
// let j = 200;
// let tab = [];
// for (let i = 0; i < 10; i++) {
// j -= 10;
// tab[i] = j;
// }
// return j;
// }
// //console.log(deb1());
// //exercice3
// function deb2(x: number, y: number): void {
// const tmp = y;
// y = x;
// x = tmp;
// //console.log(x, y);
// }
// let x = 10;
// let y = 10;
// deb2(x, y);
// //console.log(x, y);
// //exercice 4
// function deb3(xy: number[]): void {
// let tmp = xy[0];
// xy[0] = xy[1];
// xy[1] = tmp;
// console.log(xy);
// }
//let xy = [10, 20];
//deb3(xy);
//console.log(xy);
//exercice 5
let j = 10;
deb4();
console.log(j);
function deb4(): number {
let j = 25;
for (let i = 0; i < 10; i++) {
let j = 2 * i;
console.log(j);
}
return j;
}
// let j = 10;
// deb4();
// console.log(j);
// function deb4(): number {
// let j = 25;
// for (let i = 0; i < 10; i++) {
// let j = 2 * i;
// console.log(j);
// }
// return j;
// }
//exercice 6
let tab1 = [1, 2, 3];
let tab2 = [...tab1];
tab1[1] = 5;
console.log(tab1, tab2);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment