Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

99
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda