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

102
Vistas
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 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