TIPOS DE DATOS EM JAVASCRIPT

node v10.24.1
version: 1.0.0
endpointsharetweet
number
v= 23 console.log(v); typeof(v);
v * 3 + 2.34 / 1.34
27 % 5
Math.PI + Math.log(123) / 2.1 + Math.sin(23)
string
v= "Hola"; console.log(v); typeof(v);
console.log(v.length); v+" Mundo"
Array: Lista indexada de elementos
v = [1,2,4, "str", [3]] console.log(v); typeof(v)
Iteración de un array: for
for (var i=0; i<v.length; i++){ // console.log(i,v[i]); console.log(""+i+" -> "+v[i]); }
usando map
boolean
v = true console.log(v); typeof(v);
v && false || ! v
object: conjunto de parejas propiedad: valor
v = {} v = {prop1:"valor1",prop2:"valor2",prop3:"valor3"}
v.prop1 v["prop2"]
function
v = function(x){ console.log("Ejecutando función con argumento "+x); return 2 * x; }
v(12)
undefined
var z console.log(z); typeof(z);
null
var n= null console.log(z); typeof(z);
interpreca
Loading…

no comments

    sign in to comment