I have seen "=>" used in some JavaScript code examples recently and have searched high and low for some explanation as to its use, but to no avail. I assume it is used for assigning values in objects, but I would like to find some documentation on it. I am new to programming and apologize if this is one of those common sense questions.
Asked
Active
Viewed 40 times
0
-
it means something entirely different in JS: an arrow function – dandavis Jan 09 '16 at 04:25
-
Javascript https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions, PHP http://php.net/manual/en/language.types.array.php – Mi-Creativity Jan 09 '16 at 04:26
-
its the problem with asking 2 questions together on a Q&A site. – Jan 09 '16 at 04:26
-
Yea, it gets confusing. - PHP: `->` Access an object property or method. - JavaScript `.` Access a object property or method. - PHP: `=>` Set an array element. - JavaScript: Set an array element similar to JSON.. - JavaScript or PHP `['bla']` Access an array element. – user1032531 Jan 09 '16 at 04:26
-
Thank you for the information @Mi-Creativity. The docs are very helpful. – Shawn Williams Jan 09 '16 at 04:34
-
@Dagon Ahh, I see where I placed PhP in the question title. I should have left that off. I'll rephrase the question. It has been answered. – Shawn Williams Jan 09 '16 at 04:45