“convertir la cadena en matriz js” Código de respuesta

convertir la cadena en matriz js

// our string
let string = 'ABCDEFG';

// splits every letter in string into an item in our array
let newArray = string.split('');

console.log(newArray); // OUTPUTS: [ "A", "B", "C", "D", "E", "F", "G" ]
snakebite_382

JS Cadena a la matriz

// string
let string = '12345';

// splits characters string into items in our array
let array = string.split('');

console.log(array); // [ "1", "2", "3", "4", "5"]
Caffeinated Developer

Cadena a Array JavaScript

const str = 'Hello!';

console.log(Array.from(str)); //  ["H", "e", "l", "l", "o", "!"]
Leonardo

JS Cadena a la matriz

var myString = 'no,u';
var MyArray = myString.split(',');//splits the text up in chunks
If-dev

JS Cadena a la matriz

str = 'How are you doing today?';
console.log(str.split(' '));

>> (5) ["How", "are", "you", "doing", "today?"]
Ariel Ferdman

Cadena a Array JavaScript

// If you want to split on a specific character in a string:
const stringToSplit = '01-02-2020';
console.log(stringToSplit.split('-')); 
// ["01", "02", "2020"]

// If you want to split every character:
const stringToSplit = '01-02-2020';
console.log(Array.from(stringToSplit));
// ["0", "1", "-", "0", "2", "-", "2", "0", "2", "0"]
RWL_Dittrich

Respuestas similares a “convertir la cadena en matriz js”

Preguntas similares a “convertir la cadena en matriz js”

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código