Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
How to find exact string

I have an array:

and I trying to find the exactly string value with this

It works fine even if you are looking for "b" or "bt" but I would like to get result only when i'm looking for "btc" (exactly string value)

when I look for "b" or "bt" I want to get no result

let coinsArray = [{
  symbol: "btc"
}]

let newStatus = coinsArray.filter(coin => coin.symbol.includes($(".InpSearchCoin").val()))

console.log(newStatus)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" class="InpSearchCoin" value="btc" />

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Don't use includes

let coinsArray = [{
  symbol: "btc"
}]

$(".InpSearchCoin").on("input", function() {
  let symbol = coinsArray
    .filter(({symbol}) => symbol === this.value.toLowerCase())
  console.log(symbol)
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" class="InpSearchCoin" value="" />

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!