>>>>>>comments can be misleading: untested
>>>>>>
>>>>>>function MyTest( cCol1Name ) {
>>>>>>var MyObject = .... object is created
>>>>>>var Row = MyObject[0].cCol1Name;
>>>>>>var Col1Val = Row[cCol1Name]
>>>>>>// var Col1Val = eval( "Row." + cCol1Name)
>>>>>>}
>>>>>>>>>
>>>>>
>>>>>Thank you.
>>>>
>>>>The commented eval() should work as well, but is considered by some to be an anti-pattern. Was a bit short in my explanation ;-)
>>>
>>>I am very much a newbie to javascript. So I will look up this function; use, upside and downside. One thing I found so far is that javascript is very unforgiving. If I have ANYTHING wrong in my javacript (like, e.g., missing the ending ";") nothing works in the code. And no error appears when I am running it in ASP.NET. I have to be extra careful.
>>
>>Best use a debugger on the browser. I favour Chrome but it depends what you're used to.
>>
>>For Chrome when you've loaded a page hit 'Ctrl-Shift-I'.
>>The Console tab will show any exceptions.
>>You can view the JavaScript and set breakpoints in the Source tab.
>>Check Local Storage content in the Resources tab; see what's going over the wire in the Network tab
>>Play with styles and layout in the Elements tab
>>etc. etc.
>>
>>If you think you are getting exceptions during the page load then just reload the page after opening the Dev Tools.....
>
>I do use Chrome. And I do check the Local Storage content, when testing the program.
>And I will follow your steps to view the Javascript. Do I understand that you set the breakpoint in the Chrome Dev Tools, not in the VS code, right?
Yes.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement