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

Replace td_debug.ts

parent 1c572aa1
No related branches found
No related tags found
No related merge requests found
//exercice1/2 // //exercice1/2
function deb1(): number { // function deb1(): number {
let j = 200; // let j = 200;
let tab = []; // let tab = [];
for (let i = 0; i < 10; i++) { // for (let i = 0; i < 10; i++) {
j -= 10; // j -= 10;
tab[i] = j; // tab[i] = j;
} // }
return j; // return j;
} // }
//console.log(deb1()); // //console.log(deb1());
//exercice3 // //exercice3
function deb2(x: number, y: number): void { // function deb2(x: number, y: number): void {
const tmp = y; // const tmp = y;
y = x; // y = x;
x = tmp; // x = tmp;
//console.log(x, y); // //console.log(x, y);
} // }
let x = 10; // let x = 10;
let y = 10; // let y = 10;
deb2(x, y); // deb2(x, y);
//console.log(x, y); // //console.log(x, y);
//exercice 4 // //exercice 4
function deb3(xy: number[]): void { // function deb3(xy: number[]): void {
let tmp = xy[0]; // let tmp = xy[0];
xy[0] = xy[1]; // xy[0] = xy[1];
xy[1] = tmp; // xy[1] = tmp;
console.log(xy); // console.log(xy);
} // }
let xy = [10, 20]; //let xy = [10, 20];
deb3(xy); //deb3(xy);
console.log(xy); //console.log(xy);
//exercice 5 //exercice 5
let j = 10; // let j = 10;
deb4(); // deb4();
console.log(j); // console.log(j);
function deb4(): number { // function deb4(): number {
let j = 25; // let j = 25;
for (let i = 0; i < 10; i++) { // for (let i = 0; i < 10; i++) {
let j = 2 * i; // let j = 2 * i;
console.log(j); // console.log(j);
} // }
return 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