最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Reverse XOR operator in JavaScript? - Stack Overflow

programmeradmin3浏览0评论

I have 2 variables, x and y.

I am doing z = x^y.

Now assuming I know only z and y, How can I get x back? Is there an opposite to ^ in JavaScript?

I have 2 variables, x and y.

I am doing z = x^y.

Now assuming I know only z and y, How can I get x back? Is there an opposite to ^ in JavaScript?

Share Improve this question edited Aug 6, 2013 at 18:43 shannoga asked Apr 7, 2013 at 19:16 shannogashannoga 19.9k21 gold badges110 silver badges173 bronze badges 1
  • Try this at stackoverflow./questions/4540422/… – asiby Commented Aug 5, 2013 at 20:54
Add a ment  | 

2 Answers 2

Reset to default 17

Yes, ^ is its own inverse.

x == (x^y)^y

Given z=x^y

You can get x by doing x=z^y

发布评论

评论列表(0)

  1. 暂无评论