Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp-git debug
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TIRONI Baptiste
tp-git debug
Commits
af483338
Commit
af483338
authored
2 weeks ago
by
TIRONI Baptiste
Browse files
Options
Downloads
Patches
Plain Diff
fini 1
parent
cc23c470
Branches
main
Tags
fintd
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Untitled-1.js
+62
-0
62 additions, 0 deletions
Untitled-1.js
with
62 additions
and
0 deletions
Untitled-1.js
0 → 100644
+
62
−
0
View file @
af483338
function
deb1
()
{
let
j
=
200
;
let
tab
=
[];
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
j
-=
10
;
tab
.
push
(
j
);
}
return
j
;
}
function
deb2
(
x
,
y
)
{
ault
const
tmp
=
y
;
y
=
x
;
x
=
tmp
;
console
.
log
(
x
,
y
);
}
let
x
=
10
;
let
y
=
20
;
deb2
(
x
,
y
);
// 20 10 (echange de valeur)
console
.
log
(
x
,
y
);
// 10 20 (pas d'échange de valeur car x et y n'ont pas été retournés par la fonction deb2)
function
deb3
(
xy
)
{
let
tmp
=
xy
[
0
];
xy
[
0
]
=
xy
[
1
];
xy
[
1
]
=
tmp
;
console
.
log
(
xy
);
}
let
xy
=
[
10
,
20
];
deb3
(
xy
);
console
.
log
(
xy
);
// 20 10 (échange de valeur car xy est un tableau et les tableaux n'ont pas besoin d'être retournés)
let
j
=
10
;
deb4
();
console
.
log
(
j
);
function
deb4
()
{
let
j
=
25
;
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
let
j
=
2
*
i
;
console
.
log
(
j
);
// 0 2 4 6 8 10 12 14 16 18
}
return
j
;
// 25 car le premier let est local à la fonction deb4 et le second est local à la boucle for
}
/*let tab1 = [1, 2, 3];
let tab2 = tab1;
tab1[1] = 5;
console.log(tab1, tab2); // [1, 5, 3] [1, 5, 3] meme tableau
*/
let
tab1
=
[
1
,
2
,
3
];
let
tab2
=
[...
tab1
];
tab1
[
1
]
=
5
;
console
.
log
(
tab1
,
tab2
);
// [1, 5, 3] [1, 2, 3] deux tableaux différents
deb7
(
-
5
,
3
);
function
deb7
(
x
,
y
)
{
let
val
=
0
;
for
(
let
i
=
0
;
i
<
y
;
i
++
)
{
val
+=
x
;
}
return
val
;
}
/*function deb7(x: number, y: number) : number {
return x * y;
}*/
//# sourceMappingURL=Untitled-1.js.map
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment