Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
js-e001
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Silvia Barrientos
js-e001
Commits
2e064084
Commit
2e064084
authored
Sep 05, 2020
by
Silvia Barrientos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace javaScript.js
parent
31a1303f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
32 deletions
+32
-32
JavaScript/Ejercicio1/javaScript.js
+32
-32
No files found.
JavaScript/Ejercicio1/javaScript.js
View file @
2e064084
function
init
(){
var
calcular
=
document
.
getElementById
(
"calcular"
);
calcular
.
onclick
=
function
()
{
var
x
=
5
;
var
y
=
2
;
var
operaciones
=
parseInt
(
x
)
+
parseInt
(
y
);
console
.
log
(
"La suma de x más y: "
+
operaciones
);
var
operaciones
=
x
-
y
;
console
.
log
(
"La resta de x menos y: "
+
operaciones
);
var
operaciones
=
x
*
y
;
console
.
log
(
"La multiplicacion de x por y: "
+
operaciones
);
var
operaciones
=
x
/
y
;
console
.
log
(
"La division de x entre y: "
+
operaciones
);
console
.
log
(
"x elevado a la potencia de y: "
+
Math
.
pow
(
x
,
y
));
var
operaciones
=
x
%
y
;
console
.
log
(
"El resto de la división entera entre x e y: "
+
operaciones
);
}
}
function
init
(){
var
calcular
=
document
.
getElementById
(
"calcular"
);
var
x
=
document
.
getElementById
(
"n1"
);
var
y
=
document
.
getElementById
(
"n2"
);
calcular
.
onclick
=
function
()
{
x
.
textContent
=
parseInt
(
Math
.
random
()
*
10
);
y
.
textContent
=
parseInt
(
Math
.
random
()
*
10
);
calcular
=
parseInt
(
x
.
textContent
)
+
parseInt
(
y
.
textContent
);
console
.
log
(
"La suma de x más y: "
+
calcular
);
calcular
=
parseInt
(
x
.
textContent
)
-
parseInt
(
y
.
textContent
);
console
.
log
(
"La resta de x menos y: "
+
calcular
);
calcular
=
parseInt
(
x
.
textContent
)
*
parseInt
(
y
.
textContent
);
console
.
log
(
"La multiplicacion de x por y: "
+
calcular
);
calcular
=
parseInt
(
x
.
textContent
)
/
parseInt
(
y
.
textContent
);
console
.
log
(
"La division de x entre y: "
+
calcular
);
calcular
=
Math
.
pow
(
parseInt
(
x
.
textContent
),
parseInt
(
y
.
textContent
));
console
.
log
(
"x elevado a la potencia de y: "
+
calcular
);
calcular
=
parseInt
(
x
.
textContent
)
%
parseInt
(
y
.
textContent
);
console
.
log
(
"El resto de la división entera entre x e y: "
+
calcular
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment