javascript - simple if statement with if -


I am trying to add a word to a string if it is not there and I have a string with a Changed the array to (A) and used push to add new word but the new word is being added (an.length - 1) bar.

How can I fix this?

  var ime = "Open it now" var a = ime.split ('') var ene = "itt" (var i = 0; i    

You should use indexOf and string insertion

  ime = ime.indexOf (ene) === -1? Ime + '' + ene: ime   



Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -