2.3 KiB
2.3 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
56533eb9ac21ba0edf2244aa | Understanding Uninitialized Variables | 1 | Entendiendo las variables sin inicializar |
Description
undefined
. Si realiza una operación matemática en una variable undefined
, su resultado será NaN
que significa "No es un número" . Si concatena una cadena con una variable undefined
, obtendrá una cadena literal de "undefined"
. Instructions
a
, b
y c
con 5
, 10
y "I am a"
respectivamente para que no queden undefined
. Tests
tests:
- text: <code>a</code> debe definirse y evaluarse para tener el valor de <code>6</code>
testString: 'assert(typeof a === "number" && a === 6, "<code>a</code> should be defined and evaluated to have the value of <code>6</code>");'
- text: <code>b</code> debe definirse y evaluarse para que tenga el valor de <code>15</code>
testString: 'assert(typeof b === "number" && b === 15, "<code>b</code> should be defined and evaluated to have the value of <code>15</code>");'
- text: <code>c</code> no debe contener <code>undefined</code> y debe tener el valor "I am a String!"
testString: 'assert(!/undefined/.test(c) && c === "I am a String!", "<code>c</code> should not contain <code>undefined</code> and should have a value of "I am a String!"");'
- text: No cambie el código debajo de la línea
testString: 'assert(/a = a \+ 1;/.test(code) && /b = b \+ 5;/.test(code) && /c = c \+ " String!";/.test(code), "Do not change code below the line");'
Challenge Seed
// Initialize these three variables
var a;
var b;
var c;
// Do not change code below this line
a = a + 1;
b = b + 5;
c = c + " String!";
After Test
console.info('after the test');
Solution
// solution required