“Cómo encontrar el número en String JS” Código de respuesta

Cómo encontrar el número en String JS

// To find a number in a string
const str = "sdfh0d5f6"
const result = str.match(/\d+/g)

console.log(result)
// ['0', '5', '6']
Radmehr Aghdam

JavaScript Buscar número en String

the regular expression on looks for the first number character in the string

let numberInString = theString.match(/\d+/[0];
McBurd

Respuestas similares a “Cómo encontrar el número en String JS”

Preguntas similares a “Cómo encontrar el número en String JS”

Más respuestas relacionadas con “Cómo encontrar el número en String JS” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código