“Cómo declarar una variable JS” Código de respuesta

Variables JS

// 3 ways to create

var mrVariable = 'x'; // You can set it to to a string ( '' ) or no. ( 0 ). It 
// is globally defined

let myVariaible2 = 'y'; // You can set it to string or no. let is block scoped

const myVariable = 'z'; // It is block scoped, can be a string or no. and can't 
//be reassigned
Annoying Antelope

Cómo declarar una variable JS

const name = 'Anthony';
Anthony Smith

Declaración de variable de JavaScript

var name = "mamama";
document.write(name);
// Outputs "mamama"
Impossible Iguana

Cómo crear variables usando JavaScript

var myVar;       //unitialized variable( can be intiallized later )
var number = 1; //number
var string = " hello world " ; //string
var boolean = true ;  //boolean
myVar = function(){  //variable can hold function
  
};
Lanitoman

Variable en JS

var name = ""
Grumpy Goat

Respuestas similares a “Cómo declarar una variable JS”

Preguntas similares a “Cómo declarar una variable JS”

Más respuestas relacionadas con “Cómo declarar una variable JS” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código