brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

how to use "convert to arrow function" under "menu -> edit"? #14825

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by kart672 Sunday Dec 27, 2020 at 11:41 GMT Originally opened as https://github.com/adobe/brackets/issues/15295


I'm running Adobe brackets Release 1.14 Build 1.14.2-17770 (release-1.14.2 f71f00acc) on a Macbook Pro. In the edit menu when I try to run "convert to arrow function" on a normal function declaration, it says "Place the cursor inside a function expression". I just started with javascript programming like one week ago and don't know exactly what that means.

Can anybody clarify for me? This is the function I'm trying to convert into an arrow function: function addElement () { var newDiv = document.createElement("div"); var newContent = document.createTextNode("Hi there and greetings!"); newDiv.appendChild(newContent); var currentDiv = document.getElementById("div"); document.body.insertBefore(newDiv, currentDiv); }

core-ai-bot commented 3 years ago

Comment by Shettynik Wednesday Jan 06, 2021 at 06:31 GMT


const addElement = () => { var newDiv = document.createElement("div"); var newContent = document.createTextNode("Hi there and greetings!"); newDiv.appendChild(newContent); var currentDiv = document.getElementById("div"); document.body.insertBefore(newDiv, currentDiv); }

I suppose this is what you needed!!