In this video around 16:00 the instructor says dynamic object property syntax is being used (total[language]). It seems like it's just regular setting a property on an object using a variable, which here is (destructured from the repo object, the current item being iterated over in the reduce method) language. Did he make a mistake calling it a dynamic object property or am I missing something?

            Asked
            
        
        
            Active
            
        
            Viewed 70 times
        
    -1
            
            
         
    
    
        nCardot
        
- 5,992
- 6
- 47
- 83
- 
                    1Given [Dynamically access object property using variable](/q/4244896/4642212), this can indeed informally be called “dynamic” property access. This is unrelated to ECMAScript 6, by the way. – Sebastian Simon Apr 06 '22 at 07:20
- 
                    2ES6 did introduce [computed property names](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#new_notations_in_ecmascript_2015) in object literals, but as you noted in the question this is just plain bracket notation. (had they used destructruring in assigning the new value they could have used the former `{...total, [language]: ...}`) – pilchard Apr 06 '22 at 07:30
1 Answers
2
            The reason why they called it a dynamic property is because from the perspective of the total object - the language variable that is being passed in as a key can contain any value during the application runtime, hence hypothetically any property can be accessed at different runs - making it dynamic.
So the instructor was correct as there is no other official term to name a variable that is used as a property accessor.
 
    
    
        Ovidijus Parsiunas
        
- 2,512
- 2
- 8
- 18