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