Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#JavaScript (ES6) 66

JavaScript (ES6) 66

For once, the stupid negative % of javascript for negative numbers come useful

z=>(z+z).substr(-(l=z.length,[a,b]=z.match(/\d+/g),b?b+a:a)%l-l,l)

#JavaScript (ES6) 66

For once, the stupid negative % of javascript for negative numbers come useful

z=>(z+z).substr(-(l=z.length,[a,b]=z.match(/\d+/g),b?b+a:a)%l-l,l)

JavaScript (ES6) 66

For once, the stupid negative % of javascript for negative numbers come useful

z=>(z+z).substr(-(l=z.length,[a,b]=z.match(/\d+/g),b?b+a:a)%l-l,l)
Source Link
edc65
  • 32.3k
  • 3
  • 37
  • 90

#JavaScript (ES6) 66

For once, the stupid negative % of javascript for negative numbers come useful

z=>(z+z).substr(-(l=z.length,[a,b]=z.match(/\d+/g),b?b+a:a)%l-l,l)

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