How to select item on a class using a variable in javascript?

I have this class:

var animals = 
{
   "dog":{
       "name":"Doggy"
   },
   "cat":{
       "name":"Kitty"
   },
}

I want to select either dog or cat, but I get it as a variable like so:

var animal = "dog";

How can I use the “animal” variable to get the right one? This obviously doesn’t work:

animals.animal

What is the correct syntax to do this?

JavaScript rendering [object Object] in page rather than data

Hi all I am using the following code to render an excel document in an AG Grid

  function populateGrid(workbook) {
    // our data is in the first sheet
    var firstSheetName = workbook.SheetNames[0];
    var worksheet = workbook.Sheets[firstSheetName];
  
    // we expect the following columns to be present
    var columns = {
      A: 'BQ Id',
      B: 'Ref:-',
      C: '',
      D: 'Description',
      E: 'Qty',
      F: 'Unit',
      G: 'Rate',
      H: 'Amount',
    };
  
    var rowData = [];
  
    // start at the 2nd row - the first row are the headers
    var rowIndex = 2;
  
    // iterate over the worksheet pulling out the columns we're expecting
    while (worksheet['A' + rowIndex]) {
      var row = {};
      Object.keys(columns).forEach(function (column) {
        row[columns[column]] = worksheet[column + rowIndex].w;
      });
  
      rowData.push(row);
  
      rowIndex++;
    }
  
    // finally, set the imported rowData into the grid
    gridOptions.api.setRowData(rowData);
  }

This is taken from the AG Grid docs https://www.ag-grid.com/javascript-data-grid/excel-import/ however when I run this code I get the following:
Output here How can I get the code to render the actual data?

How to detect whether the camera that is chosen by the user is real or not, within the web browser?

enter image description here

I need to detect whether the camera that is chosen by the user is real or not, in the web browser.

Using JavaScript I can get label and id of the camera but stream.getVideoTracks()[0].label is changeable by the user and stream.getVideoTracks()[0].id is not unique and it also changes session to session.

With a C# app, I think that I can detect that it is real or not by looking at the property PNPDeviceID. For a real camera it is a value like USBVID… For a fake camera (in my case AlterCam) its value is ROOTIMAGE000.

But in my case I need to detect it within the web browser. How can I achieve this?

How to build “Inspect element” functionality in a website (with nested iframes) [closed]

I want to rebuild the “Inspect element” functionality that is builtin into browsers where it lets you pick an html element from the website.

It also provides you a nice visual feedback where when you mouse over the website it highlights the html element you are currently hovering over.

Important: What’s so cool about it is that it supports picking html elements from a nested iframes.

There are some libraries for that, e.g.: https://www.npmjs.com/package/pick-html-element
but it doesn’t really support nested iframes.

How to rebuild such thing in a website?

schemaTypes in sanity io

I am facing problem in schemaTypes of Sanity io
All the details are mentioned below
Any problem regarding the question U can ask me

userSchema.js

    name:'abouts',
    title:'Abouts',
    type: 'document',
    fields:[
        {
            name:'title',
            title:'Title',
            type:'string'
        },
        {
            name:'description',
            title:'Description',
            type:'string'
        },
        {
            name:'imgUrl',
            title:'ImgUrl',
            type: 'image',
            options: {
              hotspot: true,
            },
        },

    ]
} 

schema.js

import createSchema from 'part:@sanity/base/schema-creator'
import schemaTypes from 'all:part:@sanity/base/schema-type'
import { userSchema } from './userSchema'

export default createSchema({
  
  name: 'default',
  types: schemaTypes.concat([userSchema]),
}) 

Now, schemaTypes is an OBJECT as we can check from “typeof” operator, I dont understand how can we use .concat() with an Object, like .concat() is an array function which can be applied with Array, So how schemaTypes.concat([userSchema]) is working correctly??

Please help me regarding this.
Thanks

Javascript JSON fetch – skip function when response = 404

I’m a total n00b in Javascript, so I guess one of you will have a solution for me 🙂
In this case I fetch review data from inside a ‘for loop’ as you can see here:

fetch('https://api.yotpo.com/products/xx-apikey-xx/{{product.id}}/bottomline')

As not all of the products have reviews, and thus not available which gives a 404 response back for that products. This gives me a lot of errors in the console because the specific id doesn’t exist (getElementById …).

                <script>
                fetch('https://api.yotpo.com/products/xx-apikey-xx/{{product.id}}/bottomline').then(function (response) {
                    if (response.ok) return response.json();
                }).then(function (obj) {
                    var averageScore = (obj).response.bottomline.average_score;
                    var averageTen = averageScore * 2;
                    var averageOverlay = 100 - averageScore * 20;
                    var reviewCount = (obj).response.bottomline.total_reviews;
                    var reviewCountText = "reviews";
                    console.log(obj);
                    document.getElementById("jsonproductreviewcount-{{ product.id }}").innerHTML = "<span class='reviewCount d-flex'>" + reviewCount + " " + reviewCountText + "</span>";
                    document.getElementById("sterrenOverlay-{{ product.id }}").style.width = averageOverlay + "%";
                }).catch(function (error) {
                    console.error('Oops! Errrrrorrr...');
                    console.error(error);
                })
                </script>

Should I use some IF / ELSE statement to check if the productid / response gives a 200 code? But how?

I hope anyone is willing to help me out with an example. Thank you very much in advance!

when i = 3 i.e., 8 it should push into arr but it isn’t. Why?

let nums1 = [4,9,5]
let nums2 = [9,4,9,8,4]

var intersect = function(nums1, nums2) {

var arr = []

var obj = {}
for(let i=0;i<nums1.length;i++){
    if(!(nums1[i] in obj)){
        obj[nums1[i]] = 1
    }
    else{
        obj[nums1[i]] += 1
    }
}
console.log(obj)
for(let i=0;i<nums2.length;i++){
    if(obj[nums2[i]]!=0 && obj[nums2[i]]!=undefined ){ 

    //when i = 3 i.e., 8 it should push into arr but it isn't. Why?//

        arr.push(nums2[i])
        obj[nums2[i]]-=1
    }
}
console.log(obj);
return arr
};
console.log(intersect(nums1,nums2))

According to the condition

if(obj[nums2[i]]!=0 && obj[nums2[i]]!=undefined ) //which is true in case when i = 3 i.e. 8 and it should push into my arr but it isnt! why?

State becomes empty

Counter File

import React, { useState } from "react";
import Widget from "./widget";

const Counter = () => {
const [form, setForm] = useState(<></>)
const [text, setText] = useState("")

const onCounterChange =() => {
    setText(text)
}
const formLoad =() =>{
    setForm(
        <Widget 
    onCounterChange={onCounterChange}
    children={
        
        <input type="text" onChange={(e) =>{
            setText(e.target.value)
        }}/>
        
    }
    />
    )
}
return (
    <div>
        {text}
    <button onClick={formLoad}>
        load widget
    </button>
    {form}
    </div>
)
}

export default Counter

Widget File

import React from 'react'

export default function Widget(props) {
  return (
    <div className="buttons">
        {props.children}
        <button onClick={props.onCounterChange}>Save</button>
    </div>
  )
}

I have created small text printing page . for some purpose I have added children in a diff component and handling widget in a state , so when I try to change the data , text state is changing but when I click save text state becomes empty

How to use one function multiple times in reactjs?

I’m trying to create quantity section with reactjs but this is working only for one section. How can I make it multiple.

My Code:-

const BuyProducts = () => {
  const title = 'Buy Products New';
  const classes = productsStyles();

  const [qty, setQty] = useState(0);

  const quantityMinus = () => {
    if (!qty == 0) {
      setQty(qty - 1);
    }
  };
  const quantityPlus = () => {
    setQty(qty + 1);
  };

  return (
    <div>
      <div>
        <div onClick={quantityPlus} className="qty-action">
          <FontAwesomeIcon icon={faAngleUp} />
        </div>
        <div>{qty}</div>
        <div onClick={quantityMinus} className="qty-action">
          <FontAwesomeIcon icon={faAngleDown} />
        </div>
      </div>

      <div>
        <div onClick={quantityPlus} className="qty-action">
          <FontAwesomeIcon icon={faAngleUp} />
        </div>
        <div>{qty}</div>
        <div onClick={quantityMinus} className="qty-action">
          <FontAwesomeIcon icon={faAngleDown} />
        </div>
      </div>
    </div>
  );
};

Thanks for your efforts!

Div Hide And Show

In the picture, all the prices are in EUR, the prices of tr are hidden on the site.
When I click on the link above, TL and TL prices will be shown and euro prices will be hidden.
When I click on the euro link, the tl will be hidden and the euro will be displayed.
There is a problem in the code but I couldn’t solve it
thanks in advance

<button onclick="TL()">TL</button>-<button onclick="EURO()">EURO</button>

<div id="fiyat"> 29.5 </div><div id="fiyattl" style="display: none; > 400 TL </div>
<div id="fiyat1"> 29.5 </div><div id="fiyattl1" style="display: none; > 500TL</div>
<div id="fiyat2"> 29.5 </div><div id="fiyattl2" style="display: none; > 600TL </div>
<div id="fiyat3"> 29.5 </div><div id="fiyattl3" style="display: none; > 700 TL</div>
<div id="fiyat4"> 29.5 </div><div id="fiyattl4" style="display: none; > 800 TL</div>

<script>
 function TL() {
   var x = document.getElementById("fiyattl");
   var y = document.getElementById("fiyattl1");
   var z= document.getElementById("fiyattl2");
   var t = document.getElementById("fiyattl3");
   var w = document.getElementById("fiyattl4");
    if (x.style.display === "none") {
    x.style.display = "block";
    } else {
    x.style.display = "none";
    }
   if (y.style.display === "none") {
    y.style.display = "block";
    } else {
    y.style.display = "none";
    }
    if (z.style.display === "none") {
    z.style.display = "block";
    } else {
    z.style.display = "none";
    }
     if (t.style.display === "none") {
    t.style.display = "block";
    } else {
    t.style.display = "none";
     }
    if (w.style.display === "none") {
     w.style.display = "block";
     } else {
     w.style.display = "none";
     }
   }
</script>

React ref vs state to manipulate className

So I found two ways to dynamically change the className of react component. But which one is the best and most efficient?

Using ref:

class Header extends React.Component{
    dropdownRef = React.createRef()
    
    handleDropdown = () =>{
      this.dropDownRef.current.classList.toggle('open')
    };
    
    render(){
       return(
          <header>
              <div ref={this.dropdownRef} className="dropdown">
                Hello
              </div>
              <button onClick={this.handleDropdown}>Click Me!</button>
           </header>)
    }

}

Using state:

class Header extends React.Component{
    state = {isOpen : false }

    handleDropdown = () =>{
       this.setState(prev=>({
           isOpen: !prevState.isOpen
       }))
    };

    render(){
       return(
          <header>
             <div className={`dropdown ${isOpen ? "open" : ""}`}>
               Hello
             </div>
             <button onClick={this.handleDropdown}>Click Me!</button>
          </header>)
    }
}

So which one is the best way to change the class or do similar things.

Installation issues with react-awesome-query-builder

I’m trying to setup React-Awesome-Query-Builder over at npm , specifically the non TS version but using functional components together with MUI 5 widgets

The versions I have found are using TS and class components.

I have installed the MUI 5 widgets but for some reason I am getting the following errors relating to Ant Design widgets, which I don’t want as I want to use MUI V5:

    Module not found: Error: Can't resolve 'antd/dist/antd.css'
    
    Module not found: Error: Can't resolve '@ant-design/icons'

    Module not found: Error: Can't resolve 'antd/lib/locale-provider/en_US'

Any help would be great.

Print function printing columns that should be side by side down the page instead

What should be printing
enter image description here

Whats actually printing

enter image description here

Here is the code for the print function

function removeLinks(printDiv) {
            var all_links = document.getElementById(printDiv).getElementsByTagName("a");

            for (var i = 0; i < all_links.length; i++) {
                all_links[i].removeAttribute("href");
            }
        }

        function printdiv(printDiv) {
            var divCaseNote = document.getElementById(printDiv);
            var oldstr = document.body.innerHTML;
            var oldTitle = document.title;

            if (divCaseNote != null) {
                divCaseNote.style = "padding: 20px;";
                innerHTML = divCaseNote.innerHTML;
            }

            removeLinks(printDiv);

            var headstr = "<html><head rel="stylesheet" media="print" link href="/CSS/print.css"/><title> </title></head><body>";
            var footstr = "</body>";
            var newstr = document.getElementById(printDiv).innerHTML;
            document.body.innerHTML = headstr + newstr + footstr;
            document.title = oldTitle.replace(" - View Case Note", "");

            window.print()

            document.body.innerHTML = oldstr;
            document.title = oldTitle;
        }

When I check out the HTML output it has all the div tags defined with the correct column sizes but these aren’t transferred over when it prints. Does anyone know why these columns are printing one after the other as opposed to side by side.

Javascript stops working when I upload it to my server (working locally)

I am writing a website to display my family tree that my father has researched. I am using bootstrap for the html side of things. Basically, every person is represented on a card. If you click the link on the person’s name it you will be taked to the previous generation where they came from. If you click on the tags on the bottom of each card (eg 1855, wife, son, daughter etc.) it should display information about that person (born, died, etc) in the textarea visible for that generation.

I currently have three generations on the page. The first and third generations are just a husband and wife atm. The secon generation also has all of their children. Now everything is working fine when I run it on my computer. The problem is when I upload it to my server only the second generation works. The first and third generation don’t work at all. I have got no idea why. I was wondering if anyone can help me.

I made a codepen of my code and it works fine. Here is the link:
https://codepen.io/youngrant/pen/QWQEMvB

// **************** Young Family Details ****************


// **************** John Young 1855 Family Details ****************

// John Young 1855
function jy1855details() {
var res = String.fromCharCode(34);
  var myText ="Born: 1855 Sorell, TasmanianChristened: 9 January 1856nDied: 3 September 1918 Forcett, TasmanianBuried: 5 September 1918 Forcett Cemetery, Forcett, TasmaniannJohn lived in the Forcett and Sorell areas. He was at one time a butcher and farm labourer. He finally ended up a farmer in the Carlton area. He was reputed to have fourteen children, although only eleven can be found in the records.nnHe was at one time employed at " + res + "Horsecroft" + res + ", a farm near Sorell. Some of his children were born at this farm."

  document.getElementById("jyjy1855").value = myText;

}

// Sarah Ann Tustin 1855
function sat1855details() {
var res = String.fromCharCode(34);
  var myText ="Born: 26 February 1855 Forcett, TasmaniannDied: 16 October 1932 Hobart, TasmanianBuried: 18 October 1932 Forcett Cemetery, Forcett, Tasmaniann"

  document.getElementById("jyjy1855").value = myText;

}












// **************** George Edward Young 1877 Family Details ****************

// George Edward Young 1877
function gey1877details() {
var res = String.fromCharCode(34);
  var myText ="Born: 28 April 1877 Horsecroft, Sorell, TasmaniannDied: 14 March 1929 Oatlands, TasmanianBuried: 15 March 1929 St. Peters Church Cemetery, Oatlands TasmaniannGeorge was the Municipal Inspector for the Oatlands Council.nAfter his funeral a notice appeared in the Hobart Mercury stating :nThe late Mr. George Young nThe funeral of the late Mr.George Young, who died at Oatlands on Thursday took place at Oatlands yesterday afternoon.nThere was a large attendance from all parts of the district. The service was conducted at St.Peters church of England by the Rev. John Harrison. At a special meeting of the Oatlands council later in the afternoon, the Warden referred in feeling terms to the death of Mr.Young and a motion of sympathy was passed to his widow and family, councillors standing in silence.nHobart Mercury 16 March 1929nnHe died of plurosy and pneumonia.nnIn 1912 and 1913 he was residing at Forcett and in 1914 he resided at Oatlands, nHis occupation being road overseer. He became the inspector of roads in 1920 and the following year and until his death was the Municipal Inspector and the Inspector of Roads for the Oatlands District.nnHe remarried Mary Alice Cornish at an unknown date.nnHe was born at " + res + "Horsecroft" + res + "a property on the Pawlenna Road outside of Sorell."

  document.getElementById("geygey1877").value = myText;

}

// Florence Louise Wright 1879
function flw1879details() {
var res = String.fromCharCode(34);
  var myText ="Born: 5 June 1879 Tasman Peninsula, TasmaniannDied: 24 March 1924 Oatlands, TasmanianBuried: 26 March 1924 St. Peters Church Cemetery, Oatlands, TasmaniannOccupation: Home duties, State school education, C of E"

  document.getElementById("geygey1877").value = myText;

}

// Ivy Victoria Young 1901
function ivy1901details() {
var res = String.fromCharCode(34);
  var myText ="Born: 16 January 1901 Ivy Cottage, Koonya, TasmaniannDied:  2 August 1967 RHH, Hobart, TasmanianBuried: 4 August 1967 Wall 2 F2 Cornelian Bay, Tasmaniann"

  document.getElementById("geygey1877").value = myText;

}

// Edward George Young 1902
function egy1902details() {
var res = String.fromCharCode(34);
  var myText ="Born: 22 September 1902 Ivy Cottage, Premydena, TasmaniannDied:  16 December 1968 Repat Hospital, Hobart, TasmanianBuried: 19 December 1968  Cornelian Bay, TasmaniannEdward George Young was born in Premydena on 22 Sept 1902. He was the eldest son of George and Florence Young. In his early years he worked as a farm labourer for land holders in the Midlands district and then moved to Gippsland in Victoria where he worked in the rural area. He then moved to Melbourne where he worked in a glass factory. It was here that he married Lucy Everlyn Hurd of Colebrook Tasmania.nnIn 1930 he and his wife and son returned to Tasmania. nnHis wife Lucy died in 1931.nnHis son Bruce was reared by his grandmother at Colebrook until she moved to Hobart. nnEdward was employed at the Zinc Works until 1943 when he put his age back and joined the Royal Australian Navy where he was trained as a cook. He served on minesweepers, one being the Allenbrook, between Northern Australia and New Guinea. On demobilization he performed many tasks some being a cartage contractor, a fisherman and a vermin inspector for the Dept of Agriculture in the Huon District. nnHe remarried in 1957 to Vera Jean Eaves, having a son, Edward[Teddy] George. He obtained a position of groundsman and caretaker at Brighton Camp for the Dept of Army. He remained  there until he retired as a T.P.I.pensioner and bought a house in Seven Mile Beach,nnIn 1967 he was diagnosed with cancer of the bowel. He underwent an operation but it was unsuccessful and he died a year later on the 16 Decenber 1968."

  document.getElementById("geygey1877").value = myText;

}

// Amy Myra Young 1905
function amy1905details() {
var res = String.fromCharCode(34);
  var myText ="Born: 28 August 1905  Forcett, TasmaniannDied: 11 August 1939  Oatlands, Hobart, TasmaniannAmy was married to George Jones of Oatlands. They lived on a farm called " + res + "The Glen" + res + " outside Oatlands, Tasmania. They had one daughter Nola, who married a Rex McDermont."

  document.getElementById("geygey1877").value = myText;

}

// Albert Ernest Young 1908
function aey1908details() {
var res = String.fromCharCode(34);
  var myText ="Born: 9 May 1908  Forcett, TasmaniannDied: 13 May 1973  RHH, Hobart, TasmanianBuried: Cornelian Bay, Hobart, TasmaniannAlbert was at one time a van salesman in the Oatlands and surrounding districts. A travelling shop servicing outlying farms. He then became the mail contractor for the Parratah district,  a contract he held for many years. He then purchased a shop in Latrobe ,sold it and moved to another shop he purchased in Glenorchy. He then sold this and bought a Chevrolet car in which he conducted tours of Tasmania."

  document.getElementById("geygey1877").value = myText;

}

// Victor Tasman Young 1910
function vty1910details() {
var res = String.fromCharCode(34);
  var myText ="Born: 8 September 1910  Forcett, TasmaniannDied: 28 October 1973  Latrobe, TasmanianBuried: Carr Villa Cemetery, Launceston, TasmaniannVictor was employed by the Postmaster General's Department  in Launceston, Tasmania."

  document.getElementById("geygey1877").value = myText;
//  document.getElementById("vtyvty1910").value = myText;

}

// Victor Tasman Young 1910 TWO
function vty1910TWOdetails() {
var res = String.fromCharCode(34);
  var myText ="Born: 8 September 1910  Forcett, TasmaniannDied: 28 October 1973  Latrobe, TasmanianBuried: Carr Villa Cemetery, Launceston, TasmaniannVictor was employed by the Postmaster General's Department  in Launceston, Tasmania."

//  document.getElementById("geygey1877").value = myText;
  document.getElementById("vtyvty1910").value = myText;

}

// Lionel Frank Young 1915
function lfy1915details() {
var res = String.fromCharCode(34);
  var myText ="Born: 12 July 1915nnDied: 3 March 1973  RHH, Hobart, TasmaniannLionel worked at Butlers Gorge when the power station was being built. He was a shop owner in Invermay, Launceston, Tasmania called the " + res + "Busy Bee" + res + ". He moved to Hobart where he was employed at the Electroylic Zinc Co. as an electrician."

  document.getElementById("geygey1877").value = myText;

}

// Joy Olga Young 1919
function joy1919details() {
var res = String.fromCharCode(34);
  var myText ="Born: 30 May 1919 Oatlands, TasmaniannDied: 28 November 2012  Swansea, Tasmania"

  document.getElementById("geygey1877").value = myText;

}

// David Morris Young 1923
function dmy1923details() {
var res = String.fromCharCode(34);
  var myText ="Born: 30 April 1923 Oatlands, TasmaniannDied: 8 November 1979  Repat Hospital, Hobart, Tasmania"

  document.getElementById("geygey1877").value = myText;

}

// Leonard Nole Young 1923
function lny1923details() {
var res = String.fromCharCode(34);
  var myText ="Born: 30 April 1923 Oatlands, TasmaniannDied: 30 April 1923 Oatlands, Tasmania"

  document.getElementById("geygey1877").value = myText;

}





// **************** Victor Tasman Young 1910 Family Details ****************

// Joy Evone Goninon 1915
function jeg1915details() {
var res = String.fromCharCode(34);
  var myText ="Born: 25 July 1915 The Valley, Derby, TasmaniannDied: 6 December 2008 Aldersgate, Launceston, TasmanianBuried: Carr Villa Cemetery, Launceston, Tasmaniann"

  document.getElementById("vtyvty1910").value = myText;

}
  .bgdark {
   background: #d7ccc8;
    }

    .bglight {
   background:  #ffecb3;
    }

    .mystyle {
   color:  #641E16;
    }

    .mystyle02 {
   color:  #368565;
    }

    .femalecard {
   background:  #C4497F;
    }

    .femalecardlight {
   background:  #CF6D98;
    }

    .malecard {
   background:  #000060;
    }

    .malecardlight {
   background:  #000066;
    }

    .card-body {
      min-height: 190px;
      max-height: 190px;
      min-width: 170px;
      max-width: 170px;
      margin-right: 5px;
      margin-top: 5px;
      font-family: "Palatino Linotype", Georgia, Times, serif;
    }

    .card-body02 {
      min-height: 120px;
      max-height: 120px;
      min-width: 120px;
      max-width: 120px;
      margin-right: 5px;
      margin-top: 60px;
      font-family: "Palatino Linotype", Georgia, Times, serif;
    }

    .card-body01 {
      min-width: 345px;
      max-width: 345px;
      min-height: 138px;
      max-height: 138px;
      margin-top: 5px;
      margin-right: 5px;
      border: 1px solid #73AD21;
      font-family: "Palatino Linotype", Georgia, Times, serif;
    }

    .card-body03 {
      min-height: 120px;
      max-height: 120px;
      min-width: 120px;
      max-width: 120px;
      margin-right: 5px;
      margin-top: 5px;
      font-family: "Palatino Linotype", Georgia, Times, serif;
    }

    .card-body04 {
      min-width: 345px;
      max-width: 345px;
      min-height: 280px;
      max-height: 280px;
      margin-top: 5px;
      margin-right: 5px;
      border: 1px solid #73AD21;
      font-family: "Palatino Linotype", Georgia, Times, serif;
    }

    .card-body05 {
      min-width: 745px;
      max-width: 745px;
      min-height: 280px;
      max-height: 280px;
      margin-top: 5px;
      margin-right: 5px;
      border: 1px solid #73AD21;
      font-family: "Palatino Linotype", Georgia, Times, serif;
    }

    .codestyle {
       color: black;
       font-family: monospace;
       font-size: 15px;
       font-weight: 500;
       margin-top: 5px;
      font-family: "Palatino Linotype", Georgia, Times, serif;
    }


    th, td {
      padding: 1px;
      border-spacing: 1px;
    }

    a:link.biglinks {
      color: white;
      font-family: "Palatino Linotype", Georgia, Times, serif;
      text-decoration: none;
      font-size: 18px;
        line-height: 0.8;

    }

    a:visited.biglinks {
      color: white;
      font-family: "Palatino Linotype", Georgia, Times, serif;
      text-decoration: none;
      font-size: 18px;
        line-height: 0.8;
    }

    a:hover.biglinks {
      color: silver;
      font-family: "Palatino Linotype", Georgia, Times, serif;
      text-decoration: none;
      font-size: 18px;
        line-height: 0.8;
    }


    a:active.biglinks {
      color: white;
      font-family: "Palatino Linotype", Georgia, Times, serif;
      text-decoration: none;
      font-size: 18px;
        line-height: 0.8;
    }


    a:link {
      color: white;
      font-family: "Palatino Linotype", Georgia, Times, serif;
      text-decoration: none;
    }

    a:visited {
      color: white;
      font-family: "Palatino Linotype", Georgia, Times, serif;
      text-decoration: none;
    }

    a:hover {
      color: silver;
      font-family: "Palatino Linotype", Georgia, Times, serif;
      text-decoration: none;
    }


    a:active {
      color: white;
      font-family: "Palatino Linotype", Georgia, Times, serif;
      text-decoration: none;
    }
<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />

    <script type="text/javascript" src="javascript/familydetails.js"></script>

    <title>My Family Tree</title>



  </head>

<body class="bgdark">
    <center><h1> Young Family Tree</h1> <a href="#gey1877"><h3>start</h3></a><br><br></center>


 <!-- ******************  John Young 1855 ******************* -->


 <section id="jy1855">

   <div class="container-fluid py-2">

       <div class="d-flex flex-row">
         <div class="card card-body">
           <div class="malecard pt-2 pb-2 text-center">
               <a href="#" class="biglinks">John<br>Young<br><br></a>

              <!-- ******************
           <h5 class="text-white mb-0">George<br>Edward<br>Young</h5>
             ******************* -->
           </div>
          <div>
          <p class="card-text text-center pt-2">1855 - 1918</p>
          </div>
          <div onclick="jy1855details()" style="cursor: pointer;" class="malecard pb-1 text-center mt-3">
            <h6 class="text-white mb-0">1855</h6>
         </div>
         </div>


           <div class="card card-body">
             <div class="femalecard pt-2 pb-2 text-center">
               <a href="#" class="biglinks" target="self">Sarah<br>Ann<br>Tustin</a>
            </div>
            <div>
            <p class="card-text text-center pt-2">1855 - 1932</p>
            </div>
            <div onclick="sat1855details()" style="cursor: pointer;" class="femalecard pb-1 text-center mt-3">
              <h6 class="text-white mb-0">Wife</h6>
           </div>
           </div>


         </div>
         <div class="d-flex flex-row">

           <div class="card card-body01">
            <p class="card-text text-center pt-1 mt-4">Married on 2 April 1875 <br>at Sorell, Tasmania</p>
           </div>


       </div>

       <div class="d-flex flex-row">
        <textarea readonly id="jyjy1855"  class="codestyle"  rows="12" cols="87"></textarea>
       </div>
   </div>
 <br><br><br><br>
 </section>


 <!-- ******************  George Edward Young 1877 ******************* -->

<section id="gey1877">
  <div class="container-fluid py-2">

      <div class="d-flex flex-row">
        <div class="card card-body">
          <div class="malecard pt-2 pb-2 text-center">
           <a href="#jy1855" class="biglinks" target="self">George<br>Edward<br>Young</a>

             <!-- ******************
            <h5 class="text-white mb-0">George<br>Edward<br>Young</h5>
            ******************* -->
          </div>
         <div>
         <p class="card-text text-center pt-2">1877 - 1929</p>
         </div>
         <div onclick="gey1877details()" style="cursor: pointer;" class="malecard pb-1 text-center mt-3">
           <h6 class="text-white mb-0">1877</h6>
        </div>
        </div>

          <div class="card card-body">
            <div class="femalecard pt-2 pb-2 text-center">
              <a href="#" class="biglinks" target="self">Florence<br>Louise<br>Wright</a>
           </div>
           <div>
           <p class="card-text text-center pt-2">1879 - 1924</p>
           </div>
           <div onclick="flw1879details()" style="cursor: pointer;" class="femalecard pb-1 text-center mt-3">
             <h6 class="text-white mb-0">Wife</h6>
          </div>
          </div>


          <div class="card card-body02">
            <div class="femalecard pt-2 pb-1 text-center">
              <a href="#ivy1901" target="self"><h6>Ivy<br>Victoria<br>Young</h6></a>
           </div>
           <div>
           <p class="card-text text-center pt-2 pb-1">1901 - 1967</p>
           </div>
           <div onclick="ivy1901details()" style="cursor: pointer;" class="femalecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Daughter</h6>
          </div>
          </div>

          <div class="card card-body02">
            <div class="malecard pt-2 pb-1 text-center">
              <a href="#egy1902" target="self"><h6>Edward<br>George<br>Young</h6></a>
           </div>
           <div>
           <p class="card-text text-center pt-2 pb-1">1902 - 1968</p>
           </div>
           <div onclick="egy1902details()" style="cursor: pointer;" class="malecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Son</h6>
          </div>
          </div>

          <div class="card card-body02">
            <div class="femalecard pt-2 pb-1 text-center">
              <a href="#amy1905" target="self"><h6>Amy<br>Myra<br>Young</h6></a>
           </div>
           <div>
           <p class="card-text text-center pt-2 pb-1">1905 - 1939</p>
           </div>
           <div onclick="amy1905details()" style="cursor: pointer;" class="femalecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Daughter</h6>
          </div>
          </div>

          <div class="card card-body02">
            <div class="malecard pt-2 pb-1 text-center">
              <a href="#aey1908" target="self"><h6>Albert<br>Ernest<br>Young</h6></a>
           </div>
           <div>
           <p class="card-text text-center pt-2 pb-1">1908 - 1973</p>
           </div>
           <div onclick="aey1908details()" style="cursor: pointer;" class="malecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Son</h6>
          </div>
          </div>

          <div class="card card-body02">
            <div class="malecard pt-2 pb-1 text-center">
              <a href="#vty1910" target="self"><h6>Victor<br>Tasman<br>Young</h6></a>
           </div>
           <div style="background-color:#fcffa4">
           <p class="card-text text-center pt-2 pb-1">1910 - 1973</p>
           </div>
           <div onclick="vty1910details()" style="cursor: pointer;" class="malecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Son</h6>
          </div>
          </div>

          <div class="card card-body02">
            <div class="malecard pt-2 pb-1 text-center">
              <a href="#lfy1915" target="self"><h6>Lionel<br>Frank<br>Young</h6></a>
           </div>
           <div>
           <p class="card-text text-center pt-2 pb-1">1915 - 1973</p>
           </div>
           <div onclick="lfy1915details()" style="cursor: pointer;" class="malecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Son</h6>
          </div>
          </div>

     </div>
     <div class="d-flex flex-row">

          <div class="card card-body01">
           <p class="card-text text-center pt-1 mt-4">Married on 21st June 1900 <br>at Holy Trinity Church, <br>Hobart, Tasmania</p>
          </div>

          <div class="card card-body03">
            <div class="femalecard pt-2 pb-1 text-center">
              <a href="#joy1919" target="self"><h6>Joy<br>Olga<br>Young</h6></a>
           </div>
           <div>
           <p class="card-text text-center pt-2 pb-1">1919 - 2012</p>
           </div>
           <div onclick="joy1919details()" style="cursor: pointer;" class="femalecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Daughter</h6>
          </div>
          </div>

          <div class="card card-body03">
            <div class="malecard pt-2 pb-1 text-center">
              <a href="#dmy1923" target="self"><h6>David<br>Morris<br>Young</h6></a>
           </div>
           <div>
           <p class="card-text text-center pt-2 pb-1">1923 - 1979</p>
           </div>
           <div onclick="dmy1923details()" style="cursor: pointer;" class="malecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Son</h6>
          </div>
          </div>

          <div class="card card-body03">
            <div class="malecard pt-2 pb-1 text-center">
              <a href="#lny1923" target="self"><h6>Leonard<br>Noel<br>Young</h6></a>
           </div>
           <div>
           <p class="card-text text-center pt-2 pb-1">1923 - 1923</p>
           </div>
           <div onclick="lny1923details()" style="cursor: pointer;" class="malecard pb-1 text-center mt-0">
             <h6 class="text-white mb-0">Son</h6>
          </div>
          </div>

      </div>

      <div class="d-flex flex-row">
       <textarea readonly id="geygey1877"  class="codestyle"  rows="12" cols="87"></textarea>
      </div>
  </div>
<br><br><br><br>
</section>



<!-- ******************  Victor tasman Young 1855 ******************* -->


<section id="vty1910">

  <div class="container-fluid py-2">

      <div class="d-flex flex-row">
        <div class="card card-body">
          <div class="malecard pt-2 pb-2 text-center">
            <a href="#gey1877" class="biglinks" target="self">Victor<br>Tasman<br>Young</a>

          </div>
         <div>
         <p class="card-text text-center pt-2">1910 - 1973</p>
         </div>
         <div onclick="vty1910TWOdetails()" style="cursor: pointer;" class="malecard pb-1 text-center mt-3">
           <h6 class="text-white mb-0">1877</h6>
        </div>
        </div>

          <div class="card card-body">
            <div class="femalecard pt-2 pb-2 text-center">
              <a href="#" class="biglinks" target="self">Joy<br>Evone<br>Goninon</a>
           </div>
           <div>
           <p class="card-text text-center pt-2">1915 - 2008</p>
           </div>
           <div onclick="jeg1915details()" style="cursor: pointer;" class="femalecard pb-1 text-center mt-3">
             <h6 class="text-white mb-0">Wife</h6>
          </div>
          </div>


        </div>
        <div class="d-flex flex-row">

          <div class="card card-body01">
           <p class="card-text text-center pt-1 mt-4">Married on 19 December 1936 <br>at Methodist Church, <br>Launceston, Tasmania</p>
          </div>


      </div>

      <div class="d-flex flex-row">
       <textarea readonly id="vtyvty1910"  class="codestyle"  rows="12" cols="87"></textarea>
      </div>
  </div>
<br><br><br><br>
</section>



    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>


  </body>

Here is the address to my website where i uploaded it to:
https://wishicould.net/family.html

Thank you

How to add text in key value pair Object

I had two array data which I was able to convert into a key value pair object.

firstArray: [] = ['a','b','c','d']
secondArray: [] = [1,2,3,4]

Code to convert two array to Key Value Pair:

let dict = firstArray.map(function(obj, index) {
let mydict = {}
mydict[secondArray[index]] = obj;
return mydict;
});

console.log(dict) 
Output: 
 [{
  "1": "a"
}, {
  "2": "b"
}, {
  "3": "c"
}, {
  "4": "d"
}] 

Desired Output:

[{
 value: "1", name: "a"
}, {
value:  "2", name: "b"
}, {
value:  "3",name: "c"
}, {
 value: "4", name:"d"
}]

Can someone help me figure out how to achieve this.