Mainslider sets a pool of points – Subsliders take points + set max depending on points left

Have a mainslider – this fills up total points field.
subsliders take points from the total points until it reaches 0. can’t go below zero.

added some code, show what i have. subsliders nicely take over maximum from the mainslider.
when i reduce mainsliders, so do subsliders.

right now subsliders only look at max from mainslider as their max. but what should happen, if there isn’t enough points left, it should take another Max.

Example:
You’ll see if you max out main bar, you can max out sub slider 1 and 2, but the 3th slider should be blocked after a few points, because it takes spent points below zero
Anyone able to alter the code this way?

let slider = document.getElementById("sliderMain");
let output = document.getElementById("outMain");
let slider1 = document.getElementById("sub1");
let output1 = document.getElementById("out1");
let slider2 = document.getElementById("sub2");
let output2 = document.getElementById("out2");
let slider3 = document.getElementById("sub3");
let output3 = document.getElementById("out3");
let cumul1Line = [0,0,2,5,9,14,20,27,35,44,54,65,77,90,104,119,135,152,170,189,209,230,252,275,299,324,350,377,405,434,464,495,527,560,594,629,665,702,740,779,819,860,902,945,989,1034,1080,1127,1175,1224,1274];
let mainTotal = [0,2,5,9,14,27,42,59,78,100,124,150,178,208,241,276,313,352,393,437,483,531,851,633,688,754,804,865,928,994,1062,1132,1204,1278,1355,1434,1515,1598,1683,1771,1815,1905,1950,2042,2088,2182,2229,2325,2373,2472,2521,2622,2672,2775,2826,2931,2983,3090,3143,3253];


function outMain(e){
  output.innerHTML = slider.value;
  const io = e.currentTarget.elements;
  let max = io.outMain.value;
    io.total.value = mainTotal[io.outMain.value];
    io.spent.value = +io.points1.value + +io.points2.value + +io.points3.value;
    io.left.value = io.total.value - io.spent.value;
    

  io.sub1.max = max;
  io.out1.value = io.sub1.value;
  io.points1.value = cumul1Line[io.out1.value]
  io.sub2.max = max;
  io.out2.value = io.sub2.value;
  io.points2.value = cumul1Line[io.out2.value]
  io.sub3.max = max;
  io.out3.value = io.sub3.value;
  io.points3.value = cumul1Line[io.out3.value]

};
document.forms.ui.oninput = outMain;
#total,#spent,#left{width:50px;}
<form id="ui">
  <div id="mainslider">
    <label for="main" class="labels2">Level</label><output form="ui" id="outMain"></output>
    <input type="range" min="1" max="50" value="1" step="1" class="slider" id="sliderMain">
    <input type="number" min="0" value="0" id="total">
    <input type="number" min="0" value="0" id="spent">
    <input type="number" min="0" value="0" id="left">
  </div>


  <div id="subslider1">
    <output form="ui" id="out1">1</output>
    <input type="range" min="1" max="50" value="1" step="1" class="slider" id="sub1">
    <input type="number" min="0" value="0" id="points1">
  </div>
  <div id="subslider1">
    <output form="ui" id="out2">1</output>
    <input type="range" min="1" max="50" value="1" step="1" class="slider" id="sub2">
    <input type="number" min="0" value="0" id="points2">
  </div>
  <div id="subslider1">
    <output form="ui" id="out3">1</output>
    <input type="range" min="1" max="50" value="1" step="1" class="slider" id="sub3">
    <input type="number" min="0" value="0" id="points3">
  </div>
  
</form>

How to implement Microsoft Azure Blob storage for browser with environment variables?

I am trying to implement a web application that connects to Microsoft Azure in order to upload files to their cloud storage. The documentation I have been following is Manage blobs with JavaScript v12 SDK in a browser. The tutorial for which is below:

https://docs.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser

The documentation explicitly states that to use Azure SDK libraries on a website, you must convert your code to work inside the browser using a bundler. The bundler suggested is parcel-bundler

I have built the project fine, and everything is working in the browser as per the tutorial outlines however I am running into an issue when it comes to obscuring the API Keys.

The alternative tutorial, which explains uploading Azure blobs using Node.js suggests the use of environment variables:

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs

I have done this in my browser tutorial, however, when parcel bundles the project together the full API Keys can be accessed by looking in the source files suggesting they are revealed during the build process of the bundle.

It appears that I need to use a bundler as the functions used for browser use do not exist in the client-side JavaScript.

How do I get around this problem?

How to echo the selected value from a dropdown list?

I have the list of cities and provinces in my country and I added it on the dropdown list.
This is where I am getting the list

var cities={'Abra':['Bangued','Boliney','Bucay','Bucloc','Daguioman','Danglas','Dolores','La Paz','Lacub','Lagangilang','Lagayan','Langiden','Licuan-Baay','Luba','Malibcong','Manabo','Peñarrubia','Pidigan','Pilar','Sallapadan','San Isidro','San Juan','San Quintin','Tayum','Tineg','Tubo','Villaviciosa'],'Agusan del Norte':['Buenavista','Butuan','Cabadbaran','Carmen','Jabonga','Kitcharao','Las Nieves','Magallanes','Nasipit','Remedios T. Romualdez','Santiago','Tubay'],'Agusan del Sur':['Bayugan','Bunawan','Esperanza','La Paz','Loreto','Prosperidad','Rosario','San Francisco','San Luis','Santa Josefa','Sibagat','Talacogon','Trento','Veruela'],'Aklan':['Altavas','Balete','Banga','Batan','Buruanga','Ibajay','Kalibo','Lezo','Libacao','Madalag','Makato','Malay','Malinao','Nabas','New Washington','Numancia','Tangalan'],'Albay':['Bacacay','Camalig','Daraga','Guinobatan','Jovellar','Legazpi','Libon','Ligao','Malilipot','Malinao','Manito','Oas','Pio Duran','Polangui','Rapu-Rapu','Santo Domingo','Tabaco','Tiwi'],'Antique':['Anini-y','Barbaza','Belison','Bugasong','Caluya','Culasi','Hamtic','Laua-an','Libertad','Pandan','Patnongon','San Jose de Buenavista','San Remigio','Sebaste','Sibalom','Tibiao','Tobias Fornier','Valderrama'],'Apayao':['Calanasan','Conner','Flora','Kabugao','Luna','Pudtol','Santa Marcela'],'Aurora':['Baler','Casiguran','Dilasag','Dinalungan','Dingalan','Dipaculao','Maria Aurora','San Luis'],'Basilan':['Akbar','Al-Barka','Hadji Mohammad Ajul','Hadji Muhtamad','Isabela City','Lamitan','Lantawan','Maluso','Sumisip','Tabuan-Lasa','Tipo-Tipo','Tuburan','Ungkaya Pukan'],'Bataan':['Abucay','Bagac','Balanga','Dinalupihan','Hermosa','Limay','Mariveles','Morong','Orani','Orion','Pilar','Samal',],'Batanes':['Basco','Itbayat','Ivana','Mahatao','Sabtang','Uyugan'],'Batangas':['Agoncillo','Alitagtag','Balayan','Balete','Batangas City','Bauan','Calaca','Calatagan','Cuenca','Ibaan','Laurel','Lemery','Lian','Lipa','Lobo','Mabini','Malvar','Mataas na kahoy','Nasugbu','Padre Garcia','Rosario','San Jose','San Juan','San Luis','San Nicolas','San Pascual','Santa Teresita','Santo Tomas','Taal','Talisay','Tanauan','Taysan','Tingloy','Tuy'],'Benguet':['Atok','Baguio','Bakun','Bokod','Buguias','Itogon','Kabayan','Kapangan','Kibungan','La Trinidad','Mankayan','Sablan','Tuba','Tublay'],'Biliran':['Almeria','Biliran','Cabucgayan','Caibiran','Culaba','Kawayan','Maripipi','Naval'],'Bohol':['Alicia','Anda','Batuan','Bilar','Candijay','Carmen','Dimiao','Duero','Garcia Hernandez','Guindulman','Jagna','Sevilla','Lila','Loay','Loboc','Mabini','Pilar','Sierra Bullones','Valencia'],'Bukidnon':['Baungon','Cabanglasan','Damulog','Dangcagan','Don Carlos','Impasugong','Kadingilan','Kalilangan','Kibawe','Kitaotao','Lantapan','Libona','Malaybalay','Malitbog','Manolo Fortich','Maramag','Pangantucan','Quezon','San Fernando','Sumilao','Talakag','Valencia'],'Bulacan':['Angat','Balagtas','Baliuag','Bocaue','Bulakan','Bustos','Calumpit','Doña Remedios Trinidad','Guiguinto','Hagonoy','Malolos','Marilao','Meycauayan','Norzagaray','Obando','Pandi','Paombong','Plaridel','Pulilan','San Ildefonso','San Jose del Monte','San Miguel','San Rafael','Santa Maria'],'Cagayan':['Abulug','Alcala','Allacapan','Amulung','Aparri','Baggao','Ballesteros','Buguey','Calayan','Camalaniugan','Claveria','Enrile','Gattaran','Gonzaga','Iguig','Lal-lo','Lasam','Pamplona','Peñablanca','Piat','Rizal','Sanchez-Mira','Santa Ana','Santa Praxedes','Santa Teresita','Santo Niño','Solana','Tuao','Tuguegarao City'],'Camarines Norte':['Basud','Capalonga','Daet','Jose Panganiban','Labo','Mercedes','Paracale','San Lorenzo Ruiz','San Vicente','Santa Elena','Talisay','Vinzons',],'Camarines Sur':['Baao','Balatan','Bato','Bombon','Buhi','Bula','Cabusao','Calabanga','Camaligan','Canaman','Caramoan','Del Gallego','Gainza','Garchitorena','Goa','Iriga','Lagonoy','Libmanan','Lupi','Magarao','Milaor','Minalabac','Nabua','Naga','Ocampo','Pamplona','Pasacao','Pili','Presentacion','Ragay','Sagñay','San Fernando','San Jose','Sipocot','Siruma','Tigaon','Tinambac'],'Camiguin':['Catarman','Guinsiliban','Mahinog','Mambajao','Sagay'],'Capiz':['Cuartero','Dao','Dumalag','Dumarao','Ivisan','Jamindan','Maayon','Mambusao','Panay','Panitan','Pilar','Pontevedra','President Roxas','Roxas City','Sapian','Sigma','Tapaz'],'Catanduanes':['Bagamanoc','Baras','Bato','Caramoran','Gigmoto','Pandan','Panganiban','San Andres','San Miguel','Viga','Virac'],'Cavite':['Alfonso','Amadeo','Bacoor','Carmona','Cavite City','Dasmariñas','General Emilio Aguinaldo','General Mariano Alvarez','General Trias','Imus','Indang','Kawit','Magallanes','Maragondon','Mendez','Naic','Noveleta','Rosario','Silang','Tagaytay','Tanza','Ternate','Trece Martires'],'Cebu':['Alcantara','Alcoy','Alegria','Aloguinsan','Argao','Asturias','Badian','Balamban','Bantayan','Barili','Bogo','Boljoon','Borbon','Carcar','Carmen','Catmon','Cebu City','Compostela','Consolacion','Cordova','Daanbantayan','Dalaguete','Danao','Dumanjug','Ginatilan','Lapu-Lapu','Liloan','Madridejos','Malabuyoc','Mandaue','Medellin','Minglanilla','Moalboal','Naga','Oslob','Pilar','Pinamungajan','Poro','Ronda','Samboan','San Fernando','San Francisco','San Remigio','Santa Fe','Santander','Sibonga','Sogod','Tabogon','Tabuelan','Talisay','Toledo','Tuburan','Tudela'],'Compostela Valley':['Compostela','Laak','Mabini','Maco','Maragusan','Mawab','Monkayo','Montevista','Nabunturan','New Bataan','Pantukan'],'Cotabato':['Alamada','Aleosan','Antipas','Arakan','Banisilan','Carmen','Kabacan','Kidapawan','Libungan','M'lang','Magpet','Makilala','Matalam','Midsayap','Pigcawayan','Pikit','President Roxas','Tulunan'],'Davao del Norte':['Asuncion','Braulio E. Dujali','Carmen','Kapalong','New Corella','Panabo','Samal','San Isidro','Santo Tomas','Tagum','Talaingod'],'Davao del Sur':['Bansalan','Davao City','Digos','Hagonoy','Kiblawan','Magsaysay','Malalag','Matanao','Padada','Santa Cruz','Sulop'],'Davao Oriental':['Baganga','Banaybanay','Boston','Caraga','Cateel','Governor Generoso','Lupon','Manay','Mati','San Isidro','Tarragona'],'Dinagat Islands':['Basilisa','Cagdianao','Dinagat','Libjo','Loreto','San Jose','Tubajon'],'Eastern Samar':['Arteche','Balangiga','Balangkayan','Borongan','Can-avid','Dolores','General MacArthur','Giporlos','Guiuan','Hernani','Jipapad','Lawaan','Llorente','Maslog','Maydolong','Mercedes','Oras','Quinapondan','Salcedo','San Julian','San Policarpo','Sulat','Taft'],'Guimaras':['Buenavista','Jordan','Nueva Valencia','San Lorenzo','Sibunag'],'Ifugao':['Aguinaldo','Alfonso Lista','Asipulo','Banaue','Hingyon','Hungduan','Kiangan','Lagawe','Lamut','Mayoyao','Tinoc'],'Ilocos Norte':['Adams','Bacarra','Badoc','Bangui','Banna','Batac','Burgos','Carasi','Currimao','Dingras','Dumalneg','Laoag','Marcos','Nueva Era','Pagudpud','Paoay','Pasuquin','Piddig','Pinili','San Nicolas','Sarrat','Solsona','Vintar'],'Ilocos Sur':['Alilem','Banayoyo','Bantay','Burgos','Cabugao','Candon','Caoayan','Cervantes','Galimuyod','Gregorio del Pilar','Lidlidda','Magsingal','Nagbukel','Narvacan','Quirino','Salcedo','San Emilio','San Esteban','San Ildefonso','San Juan','San Vicente','Santa','Santa Catalina','Santa Cruz','Santa Lucia','Santa Maria','Santiago','Santo Domingo','Sigay','Sinait','Sugpon','Suyo','Tagudin','Vigan'],'Iloilo':['Ajuy','Alimodian','Anilao','Badiangan','Balasan','Banate','Barotac Nuevo','Barotac Viejo','Batad','Bingawan','Cabatuan','Calinog','Carles','Concepcion','Dingle','Dueñas','Dumangas','Estancia','Guimbal','Igbaras','Iloilo City','Janiuay','Lambunao','Leganes','Lemery','Leon','Maasin','Miagao','Mina','New Lucena','Oton','Passi','Pavia','Pototan','San Dionisio','San Enrique','San Joaquin','San Miguel','San Rafael','Santa Barbara','Sara','Tigbauan','Tubungan','Zarraga'],'Isabela':['Alicia','Angadanan','Aurora','Benito Soliven','Burgos','Cabagan','Cabatuan','Cauayan','Cordon','Delfin Albano','Dinapigue','Divilacan','Echague','Gamu','Ilagan','Jones','Luna','Maconacon','Mallig','Naguilian','Palanan','Quezon','Quirino','Ramon','Reina Mercedes','Roxas','San Agustin','San Guillermo','San Isidro','San Manuel','San Mariano','San Mateo','San Pablo','Santa Maria','Santiago','Santo Tomas','Tumauini'],'Kalinga':['Balbalan','Lubuagan','Pasil','Pinukpuk','Rizal','Tabuk','Tanudan','Tinglayan'],'La Union':['Agoo','Aringay','Bacnotan','Bagulin','Balaoan','Bangar','Bauang','Burgos','Caba','Luna','Naguilian','Pugo','Rosario','San Fernando','San Gabriel','San Juan','Santo Tomas','Santol','Sudipen','Tubao'],'Laguna':['Alaminos','Bay','Biñan','Cabuyao','Calamba','Calauan','Cavinti','Famy','Kalayaan','Liliw','Los Baños','Luisiana','Lumban','Mabitac','Magdalena','Majayjay','Nagcarlan','Paete','Pagsanjan','Pakil','Pangil','Pila','Rizal','San Pablo','San Pedro','Santa Cruz','Santa Maria','Santa Rosa','Siniloan','Victoria'],'Lanao del Norte':['Bacolod','Baloi','Baroy','Iligan','Kapatagan','Kauswagan','Kolambugan','Lala','Linamon','Magsaysay','Maigo','Matungao','Munai','Nunungan','Pantao Ragat','Pantar','Poona Piagapo','Salvador','Sapad','Sultan Naga Dimaporo','Tagoloan','Tangcal','Tubod'],'Lanao del Sur':['Amai Manabilang','Bacolod-Kalawi','Balabagan','Balindong','Bayang','Binidayan','Buadiposo-Buntong','Bubong','Butig','Calanogas','Ditsaan-Ramain','Ganassi','Kapai','Kapatagan','Lumba-Bayabao','Lumbaca-Unayan','Lumbatan','Lumbayanague','Madalum','Madamba','Maguing','Malabang','Marantao','Marawi','Marogong','Masiu','Mulondo','Pagayawan','Piagapo','Picong','Poona Bayabao','Pualas','Saguiaran','Sultan Dumalondong','Tagoloan II','Tamparan','Taraka','Tubaran','Tugaya','Wao'],'Leyte':['Abuyog','Alangalang','Albuera','Babatngon','Barugo','Bato','Baybay','Burauen','Calubian','Capoocan','Carigara','Dagami','Dulag','Hilongos','Hindang','Inopacan','Isabel','Jaro','Javier','Julita','Kananga','La Paz','Leyte','MacArthur','Mahaplag','Matag-ob','Matalom','Mayorga','Merida','Ormoc','Palo','Palompon','Pastrana','San Isidro','San Miguel','Santa Fe','Tabango','Tabontabon','Tacloban','Tanauan','Tolosa','Tunga','Villaba'],'Maguindanao':['Barira','Buldon','Datu Anggal Midtimbang','Datu Blah T. Sinsuat','Datu Odin Sinsuat','Kabuntalan','Matanog','Northern Kabuntalan','Parang','Sultan Kudarat','Sultan Mastura','Sultan Sumagka','Upi'],'Marinduque':['Boac','Buenavista','Gasan','Mogpog','Santa Cruz','Torrijos'],'Masbate':['Aroroy','Baleno','Balud','Batuan','Cataingan','Cawayan','Claveria','Dimasalang','Esperanza','Mandaon','Masbate City','Milagros','Mobo','Monreal','Palanas','Pio V. Corpuz','Placer','San Fernando','San Jacinto','San Pascual','Uson'],'Metro Manila':['Caloocan','Las Piñas','Makati','Malabon','Mandaluyong','Manila','Marikina','Muntinlupa','Navotas','Parañaque','Pasay','Pasig','Pateros','Quezon City','San Juan','Taguig','Valenzuela'],'Misamis Occidental':['Aloran','Baliangao','Bonifacio','Calamba','Clarin','Concepcion','Don Victoriano Chiongbian','Jimenez','Lopez Jaena','Oroquieta','Ozamiz','Panaon','Plaridel','Sapang Dalaga','Sinacaban','Tangub','Tudela'],'Misamis Oriental':['Alubijid','Balingasag','Balingoan','Binuangan','Cagayan de Oro','Claveria','El Salvador','Gingoog','Gitagum','Initao','Jasaan','Kinoguitan','Lagonglong','Laguindingan','Libertad','Lugait','Magsaysay','Manticao','Medina','Naawan','Opol','Salay','Sugbongcogon','Tagoloan','Talisayan','Villanueva'],'Mountain Province':['Barlig','Bauko','Besao','Bontoc','Natonin','Paracelis','Sabangan','Sadanga','Sagada','Tadian'],'Negros Occidental':['Bacolod','Bago','Binalbagan','Cadiz','Calatrava','Candoni','Cauayan','Enrique B. Magalona','Escalante','Himamaylan','Hinigaran','Hinoba-an','Ilog','Isabela','Kabankalan','La Carlota','La Castellana','Manapla','Moises Padilla','Murcia','Pontevedra','Pulupandan','Sagay','Salvador Benedicto','San Carlos','San Enrique','Silay','Sipalay','Talisay','Toboso','Valladolid','Victorias'],'Negros Oriental':['Amlan','Ayungon','Bacong','Bais','Basay','Bayawan','Bindoy','Canlaon','Dauin','Dumaguete','Guihulngan','Jimalalud','La Libertad','Mabinay','Manjuyod','Pamplona','San Jose','Santa Catalina','Siaton','Sibulan','Tanjay','Tayasan','Valencia','Vallehermoso','Zamboanguita'],'Northern Samar':['Allen','Biri','Bobon','Capul','Catarman','Catubig','Gamay','Laoang','Lapinig','Las Navas','Lavezares','Lope de Vega','Mapanas','Mondragon','Palapag','Pambujan','Rosario','San Antonio','San Isidro','San Jose','San Roque','San Vicente','Silvino Lobos','Victoria'],'Nueva Ecija':['Aliaga','Bongabon','Cabanatuan','Cabiao','Carranglan','Cuyapo','Gabaldon','Gapan','General Mamerto Natividad','General Tinio','Guimba','Jaen','Laur','Licab','Llanera','Lupao','Muñoz','Nampicuan','Palayan','Pantabangan','Peñaranda','Quezon','Rizal','San Antonio','San Isidro','Cabaritan','San Leonardo','Santa Rosa','Santo Domingo','Talavera','Talugtug','Zaragoza'],'Nueva Vizcaya':['Alfonso Castañeda','Ambaguio','Aritao','Bagabag','Bambang','Bayombong','Diadi','Dupax del Norte','Dupax del Sur','Kasibu','Kayapa','Quezon','Santa Fe','Solano','Villaverde'],'Occidental Mindoro':['Abra de Ilog','Calintaan','Looc','Lubang','Magsaysay','Mamburao','Paluan','Rizal','Sablayan','San Jose','Santa Cruz'],'Oriental Mindoro':['Baco','Bansud','Bongabong','Bulalacao','Calapan','Gloria','Mansalay','Naujan','Pinamalayan','Pola','Puerto Galera','Roxas','San Teodoro','Socorro','Victoria'],'Palawan':['Aborlan','Agutaya','Araceli','Balabac','Bataraza','Brooke's Point','Busuanga','Cagayancillo','Coron','Culion','Cuyo','Dumaran','El Nido','Kalayaan','Linapacan','Magsaysay','Narra','Puerto Princesa','Quezon','Rizal','Roxas','San Vicente','Sofronio Española','Taytay'],'Pampanga':['Angeles','Apalit','Arayat','Bacolor','Candaba','Floridablanca','Guagua','Lubao','Mabalacat','Macabebe','Magalang','Masantol','Mexico','Minalin','Porac','San Fernando','San Luis','San Simon','Santa Ana','Santa Rita','Santo Tomas','Sasmuan'],'Pangasinan':['Agno','Aguilar','Alaminos','Alcala','Anda','Asingan','Balungao','Bani','Basista','Bautista','Bayambang','Binalonan','Binmaley','Bolinao','Bugallon','Burgos','Calasiao','Dasol','Dagupan','Dasol','Infanta','Labrador','Laoac','Lingayen','Mabini','Malasiqui','Manaoag','Mangaldan','Mangatarem','Mapandan','Natividad','Pozorrubio','Rosales','San Carlos','San Fabian','San Jacinto','San Manuel','San Nicolas','San Quintin','Santa Barbara','Santa Maria','Santo Tomas','Sison','Sual','Tayug','Umingan','Urbiztondo','Urdaneta','Villasis'],'Quezon':['Agdangan','Alabat','Atimonan','Buenavista','Burdeos','Calauag','Candelaria','Catanauan','Dolores','General Luna','General Nakar','Guinayangan','Gumaca','Infanta','Jomalig','Lopez','Lucban','Lucena','Macalelon','Mauban','Mulanay','Padre Burgos','Pagbilao','Panukulan','Patnanungan','Perez','Pitogo','Plaridel','Polillo','Quezon','Real','Sampaloc','San Andres','San Antonio','San Francisco','San Narciso','Sariaya','Tagkawayan','Tayabas','Tiaong','Unisan'],'Quirino':['Aglipay','Cabarroguis','Diffun','Maddela','Nagtipunan','Saguday'],'Rizal':['Angono','Antipolo','Baras','Binangonan','Cainta','Cardona','Jalajala','Morong','Pililla','Rodriguez','San Mateo','Tanay','Taytay','Teresa'],'Romblon':['Alcantara','Banton','Cajidiocan','Calatrava','Concepcion','Corcuera','Ferrol','Looc','Magdiwang','Odiongan','Romblon','San Agustin','San Andres','San Fernando','San Jose','Santa Fe','Santa Maria'],'Samar':['Almagro','Basey','Calbayog','Calbiga','Catbalogan','Daram','Gandara','Hinabangan','Jiabong','Marabut','Matuguinao','Motiong','Pagsanghan','Paranas','Pinabacdao','San Jorge','San Jose de Buan','San Sebastian','Santa Margarita','Santa Rita','Santo Niño','Tagapul-an','Talalora','Tarangnan','Villareal','Zumarraga'],'Sarangani':['Alabel','Glan','Kiamba','Maasim','Maitum','Malapatan','Malungon'],'Shariff Kabunsuan':['Barira','Buldon','Datu Blah T. Sinsuat','Datu Odin Sinsuat','Kabuntalan','Matanog','Northern Kabuntalan','Parang','Sultan Kudarat','Sultan Mastura','Upi'],'Siquijor':['Enrique Villanueva','Larena','Lazi','Maria','San Juan','Siquijor'],'Sorsogon':['Barcelona','Bulan','Bulusan','Casiguran','Castilla','Donsol','Gubat','Irosin','Juban','Magallanes','Matnog','Pilar','Prieto Diaz','Santa Magdalena','Sorsogon City'],'South Cotabato':['Banga','General Santos','Koronadal','Lake Sebu','Norala','Polomolok','Santo Niño','Surallah','T'Boli','Tampakan','Tantangan','Tupi'],'Southern Leyte':['Anahawan','Bontoc','Hinunangan','Hinundayan','Libagon','Liloan','Limasawa','Maasin','Macrohon','Malitbog','Padre Burgos','Pintuyan','Saint Bernard','San Francisco','San Juan','San Ricardo','Silago','Sogod','Tomas Oppus'],'Sultan Kudarat':['Bagumbayan','Columbio','Esperanza','Isulan','Kalamansig','Lambayong','Lebak','Lutayan','Palimbang','President Quirino','Senator Ninoy Aquino','Tacurong'],'Sulu':['Banguingui','Hadji Panglima Tahil','Indanan','Jolo','Kalingalan Caluang','Lugus','Luuk','Maimbung','Old Panamao','Omar','Pandami','Panglima Estino','Pangutaran','Parang','Pata','Patikul','Siasi','Talipao','Tapul'],'Surigao del Norte':['Alegria','Bacuag','Burgos','Claver','Dapa','Del Carmen','General Luna','Gigaquit','Mainit','Malimono','Pilar','Placer','San Benito','San Francisco','San Isidro','Santa Monica','Sison','Socorro','Surigao City','Tagana-an','Tubod'],'Surigao del Sur':['Barobo','Bayabas','Bislig','Cagwait','Cantilan','Carmen','Carrascal','Cortes','Hinatuan','Lanuza','Lianga','Lingig','Madrid','Marihatag','San Agustin','San Miguel','Tagbina','Tago','Tandag'],'Tarlac':['Anao','Bamban','Camiling','Capas','Concepcion','Gerona','La Paz','Mayantoc','Moncada','Paniqui','Pura','Ramos','San Clemente','San Jose','San Manuel','Santa Ignacia','Tarlac City','Victoria'],'Tawi-Tawi':['Bongao','Languyan','Mapun','Panglima Sugala','Sapa-Sapa','Sibutu','Simunul','Sitangkai','South Ubian','Tandubas','Turtle Islands'],'Zambales':['Botolan','Cabangan','Candelaria','Iba','Masinloc','Olongapo','Palauig','San Antonio','San Felipe','San Marcelino','San Narciso','Santa Cruz','Subic'],'Zamboanga del Norte':['Baliguian','Dapitan','Dipolog','Godod','Gutalac','Jose Dalman','Kalawit','Katipunan','La Libertad','Labason','Leon B. Postigo','Liloy','Manukan','Mutia','Piñan','Polanco','President Manuel A. Roxas','Rizal','Salug','Sergio Osmeña Sr.','Siayan','Sibuco','Sibutad','Sindangan','Siocon','Sirawai','Tampilisan'],'Zamboanga del Sur':['Aurora','Bayog','Dimataling','Dinas','Dumalinao','Dumingag','Guipos','Josefina','Kumalarang','Labangan','Lakewood','Lapuyan','Mahayag','Margosatubig','Midsalip','Molave','Pagadian','Pitogo','Ramon Magsaysay','San Miguel','San Pablo','Sominot','Tabina','Tambulig','Tigbao','Tukuran','Vincenzo A. Sagun','Zamboanga City'],'Zamboanga Sibugay':['Alicia','Buug','Diplahan','Imelda','Ipil','Kabasalan','Mabuhay','Malangas','Naga','Olutanga','Payao','Roseller Lim','Siay','Talusan','Titay','Tungawan'],}
var City=function(){this.p=[],this.c=[],this.a=[],this.e={};window.onerror=function(){return!0}
this.getProvinces=function(){for(let province in cities){this.p.push(province)}
return this.p}
this.getCities=function(province){if(province.length==0){console.error('Please input province name');return}
for(let i=0;i<=cities[province].length-1;i++){this.c.push(cities[province][i])}
return this.c}
this.getAllCities=function(){for(let i in cities){for(let j=0;j<=cities[i].length-1;j++){this.a.push(cities[i][j])}}
this.a.sort();return this.a}
this.showProvinces=function(element){var str='<option selected disabled>Select Province</option>';for(let i in this.getProvinces()){str+='<option>'+this.p[i]+'</option>'}
this.p=[];document.querySelector(element).innerHTML='';document.querySelector(element).innerHTML=str;this.e=element;return this}
this.showCities=function(province,element){var str='<option selected disabled>Select City / Municipality</option>';var elem='';if((province.indexOf(".")!==-1||province.indexOf("#")!==-1)){elem=province}
else{for(let i in this.getCities(province)){str+='<option>'+this.c[i]+'</option>'}
elem=element}
this.c=[];document.querySelector(elem).innerHTML='';document.querySelector(elem).innerHTML=str;document.querySelector(this.e).onchange=function(){var Obj=new City();Obj.showCities(this.value,elem)}
return this}}

Now, the selected value is saved on the database but I want the selected value to be echoed on the dropdown list, like the selected value will stay and if page refreshes it still there.

Why does my wordpress website is taking forever to load?

I’m having issue with my website https://equipelupien.com/ . The site seems to be forever loading and as we scroll down, it brings us back up automatically until website fully loaded. It wasn’t doing this before it just started a couple days ago, nothing new was done or added to the website to create this issue. Also, the website seems to be loading a bunch of jotform on the homepage, looks like this might cause the issue but the is no forms actually on the homepage they are on other pages of the website. I contacted jotform and they were not really helpful on this matter. I’m also realizing that in my menu, the page equipe which contain submenu items is not clickable until the page is fully loaded. Any thoughts ??

javascript button function not working on first click why? [duplicate]

i’m creating a menu button and a theme button , but when i press the menu button it doesn’t work from the first click, it needs two clicks, but the theme button is working correctly , what i want is to make the menu button work from the first click

<script>
function initate() {
    var style1 = document.getElementById("themeicon");
    var logo = document.getElementById("logimg");
    let root = document.documentElement;
    var x = document.getElementById('togglebtn');
    var icon = document.getElementById('menuicon');
    let toggleclk = document.getElementById('toggle'); 
    style1.onclick = function () { 
      if(style1.className == "far fa-moon"){
      root.style.setProperty('--black1','#111');
 
  root.style.setProperty('--submit-border','#352418');
  root.style.setProperty('--submit-border-btm','#352418');
  root.style.setProperty('--light-grey','#111');
  root.style.setProperty('--light-grey2','#222');
      }
      else{
        root.style.setProperty('--black1','whitesmoke');
  root.style.setProperty('--black2','whitesmoke');
  root.style.setProperty('--black3','#fff');
  root.style.setProperty('--submit-border-btm','#91603eea');
  root.style.setProperty('--light-grey','lightgrey');
  root.style.setProperty('--light-grey2','lightgrey');
  root.style.setProperty('--box-bg','whitesmoke');
  
      }
    }
    
    toggleclk.onclick = function() {
  if (x.style.transform == "translate(130%, -160%)") {
    x.style.transform = "translate(130%, 1%)";
    x.style.opacity = "1";
    root.style.setProperty('--transform-before', 'rotate(45deg)');
    root.style.setProperty('--transform-after', 'rotate(-45deg)');
    root.style.setProperty('--transform-span', 'scaleX(0)');
  }
   else {
    x.style.transform = "translate(130%, -160%)";
    x.style.opacity = "0";
    root.style.setProperty('--transform-before', ' translateY(-10px)');
    root.style.setProperty('--transform-after', ' translateY(10px)');
    root.style.setProperty('--transform-span', ' translateY(0)');
  }
 
}

}
window.onload = initate;
</script>

what is the problem

How to use useState to store multiple key objects?

I have a candlestick chart for a crypto and it has different timeframe for 1 minute, 30, minute, and so on. I currently have

const [data, setData] = useState[]
  useEffect(() => {

    const fetchPrice = async () => {
      const { data } = await axios.get(`/api/apii?slug=${poolName[0].pool_id}&timeframe=`${1h}``); // default is 1h

      const btcusd = data.data.results.map(
        (d) => {
          return {
            open: d.open,
            close: d.close,
            low: d.low,
            high: d.high,
            time: toDateStamp(d.datetime),
          };
        }
      );
      setData(btcusd)
    };

    fetchPrice()
  }, []);

The above is the initial state whenever a user visits which he or she will be shown a 1-hour chart data. So there is this onClick button which will fetch and set new state according to he chosen timeframe. It works if i setData for one timeframe but then if I set another timeframe, how do I separate them?

Object.assign value by using Key – JavaScript

I need to assign the below object to a specific object. as a example. how to assign this value object by using Object Key.

let testObject = {
    "001":{
        name:"John"
    },
    "002":{
        name: "Mike",
        age:35
    }
};

let newObject={
    age:35
};

//Output should be like this
//let testObject = {
//   "001":{
//        name:"John"
//    },
//    "002":{
//        name: "Mike",
//        age:35
//    }
//};

find max. leaf nodes of a binary tree

       50
     /     
   25      75
  /       / 
 15  27   62  79  

depth = 3
total nodes = 7
max leaf nodes = 4
       50
     /     
   25      75
  /       / 
 15  27   62  79  
 _    _   _    _ 
 1    1   1    1  = 4

in a case where the Tree is full this will find the total amount of leaf nodes, but if the tree is not full and only the depth of the tree is known how can i know the max. leaf nodes in that tree?

// if the tree is full
function total_leafs_nodes(node, level, mxlevel)
  {
      if (node == null) {
        return 1;
      }
      if (node.left == null && node.right == null)
          return 1;

      else if (level == mxlevel)
      {
          return 1;
      }
      return (total_leafs_nodes(node.left, level + 1, mxlevel)
      + total_leafs_nodes(node.right, level + 1, mxlevel));
  }

How do i make it display users name not @ since then it displays as unidentified if person dosen’t chat discord js v12

         let UserJSON = JSON.parse(Fs.readFileSync("./DataBase/users.json"));
        var Sorted = Object.entries(UserJSON).sort((a, b) => b[1].money- a[1].money);
        if (Sorted.length > 10) Sorted = Sorted.slice(0, 10);

        var LBString = "";
        Sorted.forEach(user => {
            LBString += `${client.users.cache.find(u => u.id == user[0])} - ${user[1].money}n`;
        });
        var LBEmbed = new Discord.MessageEmbed()
            .setColor('#FFFFFF')
            .setTitle("**Coins Leaderboard**")
            .setDescription(LBString);
        message.channel.send(LBEmbed);
        client.channels.cache.get('941016208940077086').send(`${message.author.username} has used $coinslb`)

{“599675959888707594”:{“money”:492,”lastbeg”:1644580691540,”lastwork”:1644580757380},”617797297924866093″:{“money”:0,”lastbeg”:0,”lastwork”:0}}

Using normal classes with vue composition api

how can I use framework-independent JavaScript class instances with reactive state on vue-composition-api.

Given following class:

// CounterService / counter-service.ts
//
// this is a normal javascript class which is independent of vue
export const counterService = new (class CounterService {
  private count: number = 0;

  // should cause all components that use `getCount` to react.
  addOne(): void {
    this.count++;
  }

  // should be reactive
  getCount(): number {
    return this.count;
  }
})()

Kind regards
Rozbeh Chiryai Sharahi

Generate a row with empty cells and a filled select

I need to generate in JavaScript a new row on a table but with empty cell without a select who need to be the same as the other row and i want the function to work no matter where is the input in the row
here’s my function to add empty row and cells

// Insert new row in the table when clicking on the + button
// tableid: Id of the element to update
function AddRows(tableid){
    var table = document.getElementById(tableid);
    var rowCount = table.rows.length;
    var cellCount = table.rows[0].cells.length;
    var row = table.insertRow(rowCount);
     var editContent = !row.isContentEditable;
        row.contentEditable = editContent;
    row.setAttribute('onkeyup', "Disabled();");
    row.setAttribute('onclick', "SetSelectedRow(this)");
    row.setAttribute('id', 'Combo_row'+(row.rowIndex - 1)); //Set the id of the row
    row.setAttribute('class', 'default');


    for(var i =0; i < cellCount; i++){
        var cell = 'cell'+i;
        cell = row.insertCell(i);
        cell.id = 'Combo_cell' + i
    }

}

I also found this function but she copy the rows and keep the content of every cells not only the select

/* function to add row with a select */
    function addSelect(SelectTableId) {
  var T = document.getElementById(SelectTableId);

  var R = document.querySelectorAll('tbody .AddRowClass')[0];

  var C = R.cloneNode(true);

  T.appendChild(C);

    }

Mobile Safari shows keyboard after page is reloaded

I am struggling with the mobile Safari browser. I am showing a page with a search form via Next.js. When I click into input keyboard shows. When the form is submitted I prevent native submit event. Instead of the native event, I have my own function where I grab all existing query parameters and add new query parameter parsed from the input.

Then I reload the page with router.push function. After the page is reloaded input has still its focus so Safari shows the keyboard.

I tried calling blur on input but when input is blurred then it is immediately called focus event by the browser. This implies showing the keyboard.

Thanks in advance for any answer.

Update React MobX store not more often than 1 second

Our frontend React application gets multiple updates per second via web sockets that we then update the MobX store with. This causes multiple component’s rerenders and whole application to perform very poor.

What would be the most elegant solution we can develop in order to make it perform better? Is it somehow possible to gather all the data we collect within one second in some kind of temporary place and then after one second update store with it? Or is there any other better solution that can prevent multiple rerenders?

Function empty object check

I need help this task
You have to implement function that will
Check that object is empty.
Object considered to be empty when it has no properties or all its properties are false (I.e. 0, “”, false …)

Validation form does not work and has a strange behavior

I’m learning to use forms and I have a javascript code that when I click submit the page shows an error but it does it in a microsecond so I cannot read it and the page refresh it self, I have no idea about what is wrong here.
Here is my html

    <body>
    <h3>Formulario</h3>
    <form name="formName" action="#" onsubmit="return validaciones()">       
    <h4>Nombre:</h4>
    <input type="text" onkeypress="validateName(this)" name="campoNombre">
    <br>
    <br>
    <select id="opciones" name="opciones">
    <br>
    <br>
      <option value="1">Primer valor</option>
      <option value="2">Segundo valor</option>
      <option value="3">Tercer valor</option> 
      <option value="4">Cuarto valor</option>
    </select>
    <br>
    <br>
    <input type="radio" value="si" name="pregunta" id="pregunta_si"/> SI 
    <input type="radio" value="no" name="pregunta" id="pregunta_no"/> NO
    <input type="radio" value="nsnc" name="pregunta" id="pregunta_nsnc"/> NS/NC
    <br>
    <br>
    <input type="checkbox" value="condiciones" name="condiciones" id="condiciones"/> He leído 
     y acepto las condiciones
    <input type="checkbox" value="privacidad" name="privacidad" id="privacidad"/> He leído la 
    política de privacidad
    <br>
    <br>
    <textarea id="parrafo"></textarea>
    <br>
    <br>
    <input type="submit" value="submit">
    </form>

Javascript code

    function validaciones() {
      let valorNombre = document.forms["formName"]["campoNombre"].value;
      if (valorNombre == "") {
      alert("Name must be filled out");
      console.log('Ingresaste tu nombre: ' + valorNombre)
      }

      var elementos = document.getElementsByName("pregunta");
      for(var i=0; i<elementos.length; i++) {
      console.log(" Elemento: " + elementos[i].value + "n Seleccionado: " + 
      elementos[i].checked)
      }
      return false
      };    

      function validateName(item){
      value = item.value;
      console.log(value)
      };