Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Post Timeline

added 4 characters in body
Source Link
kube
  • 14.1k
  • 9
  • 37
  • 39

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key]: value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10)

Where thetop will be replaced by the variable valueevaluated before being used as key.

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key]: value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10)

Where thetop will be replaced by the variable value.

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key]: value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10)

Where thetop will be evaluated before being used as key.

deleted 1 character in body
Source Link
kube
  • 14.1k
  • 9
  • 37
  • 39

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key]: value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10);

Where thetop will be replaced by the variable value.

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key]: value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10);

Where thetop will be replaced by the variable value.

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key]: value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10)

Where thetop will be replaced by the variable value.

deleted 2 characters in body
Source Link
kube
  • 14.1k
  • 9
  • 37
  • 39

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key] : value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10);

So hereWhere thetop will be replaced by the variable value.

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key] : value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10);

So here thetop will be replaced by the variable value.

With ECMAScript 2015 you are now able to do it directly in object declaration with the brackets notation:

var obj = {
 [key] : value
}

Where key can be any sort of expression (e.g. a variable) returning a value.

So here your code would look like:

<something>.stop().animate({
 [thetop]: 10
}, 10);

Where thetop will be replaced by the variable value.

typo
Source Link
kube
  • 14.1k
  • 9
  • 37
  • 39
Loading
Source Link
kube
  • 14.1k
  • 9
  • 37
  • 39
Loading
lang-js

AltStyle によって変換されたページ (->オリジナル) /