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

92
Views
Trying to see if my text file has an object variable in it

So long story short I am making a program where it will write what you put into it like you do on a piece of paper .

I have it for every capital letter and number . Since its a bit long here is a shorted version of it

    <form  class="form1 "action="">
        <input type="text" id="fname" name="fname" value="2" >
        
    </form>
    <button type="submit" id="buttonlog"  onclick="sass();">console input</button>

my object variable is like this

const  CapitalLetters = {
    "A" : [
     "M24,36 L24,20 L13,3 L3,20 L3,36  v-10 h20 z",
    ], 
    enter code here

my function statement

function sass() {
  var answers2 = document.getElementById('fname').value;
var input = document.getElementById("buttonlog").value;
  if(CapitalLetters.hasOwnProperty(' ') == answers2) {
    console.log('yes')
    console.log(answers2);
  } else {
    console.log('no')
    console.log(answers2);
  }
}

What I am trying to do is to have it detect if what is put in the input file is in my object variable . Like how I displayed for A . So if the input tag detects capital A . Then later on it should use that code .

Edit: since somebody asked for an example . So lets say I put the letter A or b in the input . I want it to check if the letter A or b is in my object variable CapitalLetters|

Edit : Ok so I figured it out first I unmerged CapitalLetters , LowerLetters , NumberLetters and changed the format of each object from

const  CapitalLetters = {
    "A" : [
    "M24,36 L24,20 L13,3 L3,20 L3,36  v-10 h20 z",
    ],

to

  const path = CapitalLetters[input] = {
    "A" : [
     "M24,36 L24,20 L13,3 L3,20 L3,36  v-10 h20 z",
    ],

respectivly then edited my if statement to

 if(CapitalLetters.hasOwnProperty(answers2) || LowerLetters.hasOwnProperty(answers2) || NumberLetters.hasOwnProperty(answers2) ) {

Thank you all for your help

about 4 years ago · Juan Pablo Isaza
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!