--- title: 'Comprueba tus habilidades: Matematicas.' slug: 'Learn/JavaScript/First_steps/Test_your_skills:_Math' tags: - JavaScript - Matemática - Principiante - Prueba tus habilidades - aprende translation_of: 'Learn/JavaScript/First_steps/Test_your_skills:_Math' ---
El objetivo de esta prueba de habilidad es conocer si has entendido nuestra clase sobre el articulo Matematica basica en JavaScript — números y operadores.
Nota: Puedes probar soluciones en los editores interactivos a continuación, sin embargo, puede ser útil descargar el código y usar una herramienta en línea como CodePen, jsFiddle, o Glitch para trabajar en las tareas.
Si se queda atascado, pídanos ayuda; consulte la sección {{anch ("Evaluación o ayuda adicional")}} en la parte inferior de esta página.
Nota: En los ejemplos a continuación, si hay un error en su código, se mostrará en el panel de resultados de la página, para ayudarlo a tratar de averiguar la respuesta (o en la consola JavaScript del navegador, en el caso de la versión descargable).
Iniciemos poniendo a prueba sus conocimientos acerca de los operadores matemáticos básicos. Usted tendrá que crear 4 valores númericos, unir los 2 primeros, hacer una resta del cuarto con el tercero y multiplicar los resultados secundarios juntos para obtener un resultado final de 48. Y finalmente, necesita ejecutar una prueba para comprobar si el resultado es un numero par.
Asi que intente realizar la actualización del código descrito abajo para crear el ejemplo terminado, siguendo estos pasos:
finalResult
. The product should be 48. If it isn't, you'll have to adjust some of the initial input values.finalResult
is an even number. Store the result in a variable called evenOddResult
.{{EmbedGHLiveSample("learning-area/javascript/introduction-to-js-1/tasks/math/math1.html", '100%', 400)}}
Download the starting point for this task to work in your own editor or in an online editor.
In the second task you are already provided with two calculations, with the results stored in the variables result
and result2
. But these results aren't what we want; you'll need to take the calculations and change them to give us what we want.
What do we want? After multiplying the two results together and formatting the result to 2 decimal places, the final result should be 10.42.
Try updating the live code below to recreate the finished example, following these steps:
result
and result2
together and assigns the result back to result
. This will require assignment shorthand.finalResult
.finalResult
using typeof
; you'll probably see that it is actually of string
type! Write a line of code that converts it to a number
type, storing the result in a variable called finalNumber
.finalNumber
needs to be 10.42
. Go back and update the original calculations you were provided with so that they give this final result. Don't update the numbers or the operators.{{EmbedGHLiveSample("learning-area/javascript/introduction-to-js-1/tasks/math/math2.html", '100%', 400)}}
Download the starting point for this task to work in your own editor or in an online editor.
In the final task for this article, we want you to write some tests. You've got three groups, each consisting of a statement and two variables. For each one, write a test that proves or disproves the statement made. Store the results of those tests in variables called weightComparison
, heightComparison
, and pwdMatch
, respectively.
{{EmbedGHLiveSample("learning-area/javascript/introduction-to-js-1/tasks/math/math3.html", '100%', 400)}}
Download the starting point for this task to work in your own editor or in an online editor.
You can practice these examples in the Interactive Editors above.
If you would like your work assessed, or are stuck and want to ask for help: