Advice for directing further learning #1371
Replies: 11 comments
-
Posted at 2020-02-04 by @allObjects @user101594 in line 10 you pass the function reference of the today function. What you want to use for the property access is the value the function returns... therefore, just execute the function by beating its but with ()... ;-) ...give it a kick to get a kick out of it...
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-02-04 by Robin Mon 2020.02.03 @user101594
to learn
Array String Indexers > http://www.java2s.com/Tutorial/JavaScript/0220__Array/Usestringasthearrayindexer.htm |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-02-04 by user101594 Thank you very, very much indeed. This makes sense now, but I couldn't find any examples which illustrated it in usual places (W3, StackOverflow, etc.). Probably wasn't searching for the right terms. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-02-04 by user101594 I restructured my data in "days" a few times and lost understanding of what I was dealing with. I thought that it was an object as I couldn't reference its contents with an index e.g
Firefox console says:
If it's an array after all, then I'll do some more reading about arrays. Thanks |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-02-05 by Robin Tue 2020.02.04
I get that some identifier will be returned from the results of a completed task within a function. And, . . . that value will somehow reference items in a list perhaps? @user101594 are we attempting to work with an array, or Json Object Notation? L1 in code block found in post #1 is creating a Javascript variable whose content is a JSON object. Is the attempt to reference that JSON object 'key' by 'name' and extract it's corresponding 'value'? . . . or, . . . Is the thinking to access an array by it's indexer? Or an array of a two dim array elements by an indexer?
> I'm not at a development station with an active Espruino device connected, doing the following from memory. . . . Debug tip should this not yet be understood Typing
Entering the variable by name |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-02-05 by @allObjects When you have an object with (named) properties -
After all, it is just syntax, and the interpreter knows what kind 'thing' it is that is in front of the square brackets:
Even though the Array is also an object... it is fundamentally different intrinsic to the implementation and behaves as such differently, even though it has similar looks and analogue functionality - as JSON shows. On the other hand, you can think reverse:
After all it is just a notation by convention and pure syntax - sugar or salt, what ever you like - that spices up the code... (hence it's name code, coding, codified meaning). There is more of the CS Formal Languages theory/philosophy around this... like What are the real, realm specific differences between |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-02-06 by Robin Wed 2020.02.05
OPTION BASE ZERO vs OPTION BASE ONE Referencing the element using indexer 2 when there are only two elements using Option Base Zero, will yield undefined as a result, since there is only element zero and element one. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-02-06 by @allObjects If you have an object
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-03-16 by user101594 @robin and @allObjects But I came back to it over the weekend, reflected more on what I was doing and got pretty much to where I wanted to get to. Thanks very much for taking the time to reply - it did help. And knowing about dump() is going to be a big help going forward. For the record, I think that I'd been getting confused by looking at code examples which featured JSON without really clocking that they were JSON. I simplified my data to being an "object of objects", adapted my functions to not rely on indexers and now it works. The only thing which would have made life a bit nicer is the Object.values() method which I learnt about while reading around. I guess there isn't enough space to include everything in Espruino - shouldn't be greedy :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-03-16 by Robin Mon 2020.03.16
In all fairness to the analysis; The Object.values() method is a built in object of the Javascript language.
Espruino is an Interpreter of the JavaScript language. The reference that may have been used: is the API for Espruino and not the Javascript language itself.
> 'having two very young kids' Congrats are in order. Two future Espruino developers. . . . |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-03-16 by @allObjects @user101594,
Don't be that hard on yourself... first of all: there are the real 'things', that secure the future: the kids, and there are the imaginary / imagined things: formal languages, among them: JS. I'm convinced if someone had provided you with the right bench to sit on and overlook the CS landscape, you would say: nothing easier than that - and a great, relaxing balance - to rearing two children... and tend to their comprehensive / challenging everything every minute needs. If you were asked to build and present - show and tell about - a (logical) machine / computer / mc that can memorize things by name - property name, such as mail slots for Miller, Fox, Whale,... - and location - (storage) index / place, such as first, second, third,... - you would have come up with congruent patterns for describing and coding of it. Any interpreter - human or machine - listens / reads the data and processes it according to conventions to information and executable instructions... just as you listen to your kids' expressions - visual and audible - and you do as you go. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2020-02-03 by user101594
I've stumbled across a problem that I can't get my head around and am not sure what to search for to learn how to resolve it. Can anyone help name a technique or method which I can read up on?
I'm trying to access a propety of an object which changes depending on the output of a function. This is a simplified example:
Espruino says:
Do I need to get today to return a string instead? Any help would be much appreciated.
This is a situation where I don't know enough to help myself :)
Beta Was this translation helpful? Give feedback.
All reactions