await is only valid in async function

The error is not refering to myfunction but to start. I use the opportunity of this question to advise you about an known anti pattern using await which is : return await. WRONG CORRECT Also, know that there is a special case where return await is correct and important : (using try/catch)

How can I merge properties of two JavaScript objects dynamically?

ECMAScript 2018 Standard Method You would use object spread: merged is now the union of obj1 and obj2. Properties in obj2 will overwrite those in obj1. Here is also the MDN documentation for this syntax. If you’re using babel you’ll need the babel-plugin-transform-object-rest-spread plugin for it to work. ECMAScript 2015 (ES6) Standard Method Method for ES5 and Earlier Note that this will simply add all attributes of obj2 to obj1 which … Read more

How to create multidimensional array

http://jsfiddle.net/z4Un3/ And if you’re wanting to store DOM elements: Not real sure how useful the above is until you attach the elements. The below may be more what you’re looking for: http://jsfiddle.net/z4Un3/3/ Or, maybe this: Which gives: In the console. If you want to output that to text, you can result.join(‘ ‘);, which would give you 2 … Read more

How to create an associative array in JavaScript literal notation

JavaScript has no associative arrays, just objects. Even JavaScript arrays are basically just objects, just with the special thing that the property names are numbers (0,1,…). So look at your code first: It’s important to understand that myArray[‘a’] = 200; is identical to myArray.a = 200;! So to start with what you want: You can’t create a JavaScript array and … Read more

Disabling and enabling a html input button

Using Javascript Disabling a html buttondocument.getElementById(“Button”).disabled = true; Enabling a html buttondocument.getElementById(“Button”).disabled = false; Demo Here Using jQuery All versions of jQuery prior to 1.6 Disabling a html button$(‘#Button’).attr(‘disabled’,’disabled’); Enabling a html button$(‘#Button’).removeAttr(‘disabled’); Demo Here All versions of jQuery after 1.6 Disabling a html button$(‘#Button’).prop(‘disabled’, true); Enabling a html button$(‘#Button’).prop(‘disabled’, false); Demo Here P.S. Updated … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)