Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
Get numbers of difference in two strings javascript

i have two string

const string1 = "usa(Country), with concealed(O), zipper(Closure)"
const string2 = "usa(Country), with(O), concealed zipper(Closure)"

I want to find diff in these two string for example in this scenario it is 2

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'm presuming the strings need to be compared based on the comma separations, but to be fair there isn't enough details in the question...

Split the strings by comma

// split function will be an array of strings
const split = (str, delimiter) => str.split(delimiter)

Apply the above function to both strings, and compare the results

// this uses lodash
// result will be an array, get the length
const result = _.difference(split(string1, ','), split(string2, ',')

If you're not going to use lodash, you can look up the vanilla JS implementation of difference

If order is important, you may need _.xor, but you can determine that with testing

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda