I want to load images dynamically by using javascript

var only_chapter = [[“19″,”2191141”],[“18″,”1918042”],[“17″,”1189512”],[“16″,”950194”],[“15″,”408357”],[“14″,”58087”],[“13″,”58091”],[“12″,”58096”],[“11″,”58103”],[“10″,”58109”],[“9″,”58116”],[“8″,”58121”],[“7″,”58128”],[“6″,”58134”],[“5″,”58140”],[“4″,”58147”],[“3″,”58153”],[“2″,”58159”],[“1″,”58164”]]; var chapter = 2191141; var img_list = [“https:\/\/example.com\/upload\/zxcvbn.jpg”,”https:\/\/example.com\/upload\/qwerty.jpg”]; If there is javascript like this i want to add that only_chapter like this <select class=”chapter_selector”><option value=”2191141″ selected=””>19</option><option value=”1918042″>18</option></select> and one option value same as var chapter shoud be shown as selected. and img_list should be placed like this <div class=”imgs”><img src=”https://example.com/upload/zxcvbn.jpg”><img src=”https://example.com/upload/qwerty.jpg”></div>…

Find by value in JavaScript object

I’m struggling with some task in javascript. I have the following object: const methods = { searchRanking: { id: ‘tmEM6RoEPmUO’, template: ‘main_template’, startUrl: ‘https://www.amazon.de/s?k={value}’, startValueOverrideName: ‘url’, dataProcessor: function (data) { return data.map(/*doe shit met data*/) } }, productDetails: { id: ‘tAewRCbTuuL5’, template: ‘main_template’, startUrl: ‘https://www.amazon.de/dp/{value}’, startValName: ‘url’, dataProcessor: function (data) { return data.map(/*doe shit met…

How do I call ReactJS class component and functional component from normal Javascript function?

I wanted to call a ReactJS function ( functional Component ) from the normal JavaScript function. Its not printing the output because ReactJS uses the JSX syntax. Is it possible to call ReactJS functional component from the normal JS fucntion ? My Example code is here : class Extra extends React.Component { //This is the…

How to wrap a around ® with vanilla JavaScript?

The current jQuery looks like this: jQuery(function($) { $(‘body :not(script,sup)’).contents().filter(function() { return this.nodeType === 3; }).replaceWith(function() { return this.nodeValue.replace(/[®]/g, ‘<sup>$&</sup>’); }); }); Here is the StackOverflow question, I found it: https://stackoverflow.com/a/19364698/8207054 The problem looks like this: I have a text like this: <div>test®</div> but it needs to be modified to this: <div>test<sup>®</sup></div> This needs to…

Javascript adding multiple arrays in a loop

I am trying to add multiple arrays in javascript. Here are my arrays I have made, and are working. function getAmountSpent(){ var amountSpent = ((Math.random() * 500) + 1); return amountSpent.toFixed(2) } function getGift(){ var gift = ((Math.random()* 50) + 1); return gift.toFixed(2) } var names = [“Jeremy”,”Arun”,”Alisa”,”Rohan”,”Dana”]; var spent = []; for (let i…

Javascript adding multiple arrays in a loop

I am trying to add multiple arrays in javascript. Here are my arrays I have made, and are working. function getAmountSpent(){ var amountSpent = ((Math.random() * 500) + 1); return amountSpent.toFixed(2) } function getGift(){ var gift = ((Math.random()* 50) + 1); return gift.toFixed(2) } var names = [“Jeremy”,”Arun”,”Alisa”,”Rohan”,”Dana”]; var spent = []; for (let i…

How to make functions execute synchronously in javascript? or how to make functions execute one after another?

Here is my function function two(){ console.log(‘two’) } function one(callback){ setTimeout(()=>{ console.log(‘one’) },2000) callback() } one(two) Actual output: two one My expected Output: one two My question is how to make changes to these functions so that function two() will be executed after function one()