modify string using javascript [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to modify a string in JavaScript as required.suppose
I have a string 4x i need to insert * between 4 and x and
get it as 4*x
if it is 9x i should get it as 9*x etc
if it is sin(4x) i should get it as sin(4*x)
if it is sin(x) i should get it as sin(x).
if it is sin(4 x+5) i should get it as sin(4*x+5)
how to do this in java script.
any help is appreciable.

Use replace() with capturing group
document.write('4x , 5x , 5x+3 , sin(4 x+5) , sin(4x)'.replace(/(\d+)\s*([a-z])/ig,'$1*$2'));

Related

How can I convert this python line of code to java script? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last month.
Improve this question
return hex(id(self.table[hash]))
I do not know how to convert the following code from python to java script.
You don't.
There is no equivalent code to that in JavaScript, since id returns the address of the object (in CPython anyway), and there's no way to do that in JavaScript.

How to show the time of a post being posted using express [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have no idea how to render the time of a post being posted on my blog. I am using express as backend and template engine (express-edge).
you could use https://www.npmjs.com/package/i18n-js if you need to translate a date into anothers langages
you could also just use this
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat

Return five characters before and after the match in a regex [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a simple Regex to match 'der' - /der/g
I need the context around the match. Is there any way to build the regex that way? Thank you in advance.
If you want to match the context plus the search string, simply add the optional range before and after the searched string: .{0,5}der.{0,5}
If you want to get the context only, you have to fetch it separately: (.{0,5})der(.{0,5})

How can I decode this JavaScript code? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to decode the following script but can't seem to get it in working state.
I tried to decode it on http://ddecode.com/hexdecoder/ but can't understand the first few lines.
var _0x2a14=["\x7B","\x73\x70\x6C\x69\x74","\x6C\x65\x6E\x67\x74\x68\x7B\x2E\x75\x73\x65\x72\x43\x6F\x6E\x74\x65\x6E\x74\x57\x72\x61\x70\x70\x65\x72\x2C\x2E\x66\x62\x55\x73\x65\x72\x43\x6F\x6E\x74\x65\x6E\x74\x7B\x70\x61\x72\x65\x6E\x74\x73\x7B\x68\x61\x73\x2D\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x7B\x61\x64\x64\x43\x6C\x61\x73\x73\x7B\x6E\x65\x78\x74\x7B\x2E\x75\x73\x65\x72\x43\x6F\x6E\x74\x65\x6E\x74\x3A\x6C\x61\x73\x74\x7B\x66\x69\x6E\x64\x7B\x76\x69\x64\x65\x6F\x7B\x68\x61\x73\x7B\x77\x69\x64\x74\x68\x7B\x61\x74\x74\x72\x7B\x64\x61\x74\x61\x2D\x76\x69\x64\x65\x6F\x2D\x69\x64\x7B\x5B\x64\x61\x74\x61\x2D\x76\x69\x64\x65\x6F\x2D\x69\x64\x5D\x7B\x69\x73\x4E\x75\x6D\x65\x72\x69\x63\x7B\x68\x72\x65\x66\x7B\x61\x5B\x72\x65\x6C\x3D\x74\x68\x65\x61\x74\x65\x72\x5D\x7B\x24\x31\x7B\x72\x65\x70\x6C\x61\x63\x65\x7B\x61\x6A\x61\x78\x69\x66\x79\x7B\x65\x61\x63\x68\x7B\x61\x7B\x76\x61\x6C\x7B\x69\x6E\x70\x75\x74\x5B\x6E\x61\x6D\x65\x3D\x66\x74\x5F\x65\x6E\x74\x5F\x69\x64\x65\x6E\x74\x69\x66\x69\x65\x72\x5D\x7B\x3C\x64\x69\x76\x20\x69\x64\x3D\x27\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2D\x7B\x27\x20\x63\x6C\x61\x73\x73\x3D\x27\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x27\x3E\x7B\x3C\x66\x69\x65\x6C\x64\x73\x65\x74\x3E\x7B\x3C\x6C\x65\x67\x65\x6E\x64\x3E\x7B\x3C\x61\x20\x74\x61\x72\x67\x65\x74\x3D\x27\x5F\x62\x6C\x61\x6E\x6B\x27\x20\x68\x72\x65\x66\x3D\x27\x68\x74\x74\x70\x73\x3A\x2F\x2F\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x27\x20\x74\x69\x74\x6C\x65\x3D\x27\x46\x61\x63\x65\x62\x6F\x6F\x6B\x20\x56\x69\x64\x65\x6F\x20\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x20\x2D\x20\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x66\x61\x63\x65\x62\x6F\x6F\x6B\x20\x76\x69\x64\x65\x6F\x27\x3E\x7B\x3C\x69\x6D\x67\x20\x63\x6C\x61\x73\x73\x3D\x27\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2D\x6C\x6F\x67\x6F\x27\x20\x73\x72\x63\x3D\x27\x68\x74\x74\x70\x73\x3A\x2F\x2F\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x2F\x66\x61\x76\x69\x63\x6F\x6E\x73\x2F\x66\x62\x76\x69\x64\x65\x6F\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2F\x66\x61\x76\x69\x63\x6F\x6E\x2D\x33\x32\x78\x33\x32\x2E\x70\x6E\x67\x27\x20\x2F\x3E\x7B\x50\x6F\x77\x65\x72\x65\x64\x20\x62\x79\x20\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x7B\x3C\x2F\x61\x3E\x20\x7B\x3C\x2F\x6C\x65\x67\x65\x6E\x64\x3E\x7B\x3C\x64\x69\x76\x3E\x7B\x43\x61\x6E\x27\x74\x20\x67\x65\x74\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x6C\x69\x6E\x6B\x73\x20\x6F\x66\x20\x74\x68\x69\x73\x20\x76\x69\x64\x65\x6F\x20\x6F\x6E\x20\x6E\x65\x77\x73\x66\x65\x65\x64\x2E\x20\x3C\x62\x72\x20\x2F\x3E\x7B\x50\x6C\x65\x61\x73\x65\x20\x72\x69\x67\x68\x74\x20\x63\x6C\x69\x63\x6B\x20\x6F\x6E\x20\x76\x69\x64\x65\x6F\x20\x2D\x3E\x20\x53\x68\x6F\x77\x20\x76\x69\x64\x65\x6F\x20\x55\x52\x4C\x20\x2D\x3E\x20\x43\x6F\x70\x79\x20\x55\x72\x6C\x20\x2D\x3E\x20\x50\x61\x73\x74\x65\x20\x55\x72\x6C\x20\x74\x6F\x20\x6E\x65\x77\x20\x74\x61\x62\x2E\x20\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x62\x75\x74\x74\x6F\x6E\x73\x20\x77\x69\x6C\x6C\x20\x62\x65\x20\x73\x68\x6F\x77\x6E\x20\x75\x6E\x64\x65\x72\x20\x76\x69\x64\x65\x6F\x2E\x20\x3C\x62\x72\x20\x2F\x3E\x7B\x49\x66\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x62\x75\x74\x74\x6F\x6E\x73\x20\x68\x61\x76\x65\x6E\x27\x74\x20\x73\x68\x6F\x77\x6E\x2C\x20\x70\x6C\x65\x61\x73\x65\x20\x3C\x61\x20\x74\x61\x72\x67\x65\x74\x3D\x27\x5F\x62\x6C\x61\x6E\x6B\x27\x20\x68\x72\x65\x66\x3D\x27\x68\x74\x74\x70\x73\x3A\x2F\x2F\x63\x68\x72\x6F\x6D\x65\x2E\x67\x6F\x6F\x67\x6C\x65\x2E\x63\x6F\x6D\x2F\x77\x65\x62\x73\x74\x6F\x72\x65\x2F\x64\x65\x74\x61\x69\x6C\x2F\x61\x77\x65\x73\x6F\x6D\x65\x2D\x66\x61\x63\x65\x62\x6F\x6F\x6B\x2D\x76\x69\x64\x65\x6F\x2D\x64\x6F\x2F\x6B\x6D\x6D\x69\x6E\x6A\x6F\x6F\x65\x6D\x6D\x68\x68\x62\x70\x6B\x62\x66\x6D\x6A\x68\x6B\x6E\x66\x66\x70\x6C\x6D\x6A\x6B\x66\x69\x2F\x73\x75\x70\x70\x6F\x72\x74\x27\x3E\x72\x65\x70\x6F\x72\x74\x20\x74\x6F\x20\x64\x65\x76\x20\x74\x65\x61\x6D\x3C\x2F\x61\x3E\x2E\x7B\x3C\x2F\x64\x69\x76\x3E\x7B\x3C\x2F\x66\x69\x65\x6C\x64\x73\x65\x74\x3E\x7B\x61\x66\x74\x65\x72\x7B\x76\x69\x64\x65\x6F\x49\x64\x7B\x76\x69\x64\x65\x6F\x55\x72\x6C\x7B\x68\x74\x74\x70\x73\x3A\x2F\x2F\x77\x77\x77\x77\x2E\x66\x61\x63\x65\x62\x6F\x6F\x6B\x2E\x63\x6F\x6D\x2F\x7B\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x55\x72\x6C\x7B\x68\x74\x74\x70\x73\x3A\x2F\x2F\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x2F\x76\x69\x64\x65\x6F\x73\x2F\x7B\x68\x64\x7B\x2F\x76\x69\x64\x65\x6F\x2D\x68\x64\x2E\x6D\x70\x34\x7B\x73\x64\x7B\x2F\x76\x69\x64\x65\x6F\x2D\x73\x64\x2E\x6D\x70\x34\x7B\x23\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2D\x7B\x3C\x64\x69\x76\x20\x63\x6C\x61\x73\x73\x3D\x27\x63\x6C\x65\x61\x72\x66\x69\x78\x27\x3E\x7B\x3C\x64\x69\x76\x20\x63\x6C\x61\x73\x73\x3D\x27\x70\x75\x6C\x6C\x2D\x6C\x65\x66\x74\x27\x3E\x7B\x3C\x64\x69\x76\x20\x63\x6C\x61\x73\x73\x3D\x27\x70\x75\x6C\x6C\x2D\x72\x69\x67\x68\x74\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x2D\x62\x75\x74\x74\x6F\x6E\x73\x27\x3E\x20\x3C\x62\x3E\x4C\x6F\x61\x64\x69\x6E\x67\x20\x2E\x2E\x2E\x3C\x2F\x62\x3E\x7B\x3C\x64\x69\x76\x20\x73\x74\x79\x6C\x65\x3D\x27\x6D\x61\x72\x67\x69\x6E\x2D\x74\x6F\x70\x3A\x20\x35\x70\x78\x3B\x20\x74\x65\x78\x74\x2D\x61\x6C\x69\x67\x6E\x3A\x20\x72\x69\x67\x68\x74\x27\x3E\x7B\x2D\x2D\x2D\x20\x6F\x72\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x66\x72\x6F\x6D\x20\x7B\x3C\x61\x20\x74\x61\x72\x67\x65\x74\x3D\x27\x5F\x62\x6C\x61\x6E\x6B\x27\x20\x68\x72\x65\x66\x3D\x27\x7B\x27\x20\x74\x69\x74\x6C\x65\x3D\x27\x56\x69\x64\x65\x6F\x20\x55\x72\x6C\x27\x3E\x7B\x68\x74\x74\x70\x73\x3A\x2F\x2F\x77\x77\x77\x2E\x66\x61\x63\x65\x62\x6F\x6F\x6B\x2E\x63\x6F\x6D\x2F\x76\x69\x64\x65\x6F\x2F\x65\x6D\x62\x65\x64\x3F\x76\x69\x64\x65\x6F\x5F\x69\x64\x3D\x7B\x73\x64\x5F\x73\x72\x63\x5F\x6E\x6F\x5F\x72\x61\x74\x65\x6C\x69\x6D\x69\x74\x3A\x22\x7B\x73\x70\x6C\x69\x74\x7B\x73\x64\x5F\x73\x72\x63\x5F\x6E\x6F\x5F\x72\x61\x74\x65\x6C\x69\x6D\x69\x74\x22\x3A\x22\x7B\x22\x7B\x2F\x7B\x68\x64\x5F\x73\x72\x63\x5F\x6E\x6F\x5F\x72\x61\x74\x65\x6C\x69\x6D\x69\x74\x3A\x22\x7B\x68\x64\x5F\x73\x72\x63\x5F\x6E\x6F\x5F\x72\x61\x74\x65\x6C\x69\x6D\x69\x74\x22\x3A\x22\x7B\x53\x44\x20\x69\x73\x6E\x27\x74\x20\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x7B\x3C\x61\x20\x63\x6C\x61\x73\x73\x3D\x27\x62\x74\x6E\x20\x62\x74\x6E\x2D\x64\x65\x66\x61\x75\x6C\x74\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x2D\x73\x64\x27\x20\x74\x61\x72\x67\x65\x74\x3D\x27\x5F\x62\x6C\x61\x6E\x6B\x27\x20\x68\x72\x65\x66\x3D\x27\x7B\x27\x20\x74\x69\x74\x6C\x65\x3D\x27\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x53\x44\x20\x76\x69\x64\x65\x6F\x27\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x3D\x27\x46\x61\x63\x65\x62\x6F\x6F\x6B\x20\x76\x69\x64\x65\x6F\x20\x7B\x20\x53\x44\x20\x2D\x20\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x2E\x6D\x70\x34\x27\x3E\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x53\x44\x3C\x2F\x61\x3E\x20\x7B\x48\x44\x20\x69\x73\x6E\x27\x74\x20\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x7B\x3C\x61\x20\x63\x6C\x61\x73\x73\x3D\x27\x62\x74\x6E\x20\x62\x74\x6E\x2D\x70\x72\x69\x6D\x61\x72\x79\x20\x74\x65\x78\x74\x2D\x62\x6F\x6C\x64\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x2D\x68\x64\x27\x20\x74\x61\x72\x67\x65\x74\x3D\x27\x5F\x62\x6C\x61\x6E\x6B\x27\x20\x68\x72\x65\x66\x3D\x27\x7B\x27\x20\x74\x69\x74\x6C\x65\x3D\x27\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x48\x44\x20\x76\x69\x64\x65\x6F\x27\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x3D\x27\x46\x61\x63\x65\x62\x6F\x6F\x6B\x20\x76\x69\x64\x65\x6F\x20\x7B\x20\x48\x44\x20\x2D\x20\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x2E\x6D\x70\x34\x27\x3E\u21E9\x20\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x48\x44\x3C\x2F\x61\x3E\x20\x7B\x68\x74\x6D\x6C\x7B\x20\x2E\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x2D\x62\x75\x74\x74\x6F\x6E\x73\x7B\x68\x74\x74\x70\x73\x3A\x2F\x2F\x77\x77\x77\x2E\x66\x61\x63\x65\x62\x6F\x6F\x6B\x2E\x63\x6F\x6D\x2F\x7B\x54\x68\x69\x73\x20\x76\x69\x64\x65\x6F\x20\x64\x6F\x65\x73\x6E\x27\x74\x20\x68\x61\x76\x65\x20\x61\x6E\x79\x20\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x6C\x69\x6E\x6B\x73\x7B\x20\x53\x44\x20\x7B\x77\x7B\x78\x7B\x68\x7B\x20\x2D\x20\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x2E\x6D\x70\x34\x27\x3E\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x53\x44\x3C\x2F\x61\x3E\x20\x7B\x20\x48\x44\x20\x7B\x20\x2D\x20\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x2E\x6D\x70\x34\x27\x3E\u21E9\x20\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x48\x44\x3C\x2F\x61\x3E\x20\x7B\x67\x65\x74\x7B\x2E\x75\x73\x65\x72\x43\x6F\x6E\x74\x65\x6E\x74\x57\x72\x61\x70\x70\x65\x72\x2C\x2E\x66\x62\x55\x73\x65\x72\x43\x6F\x6E\x74\x65\x6E\x74\x3A\x6E\x6F\x74\x28\x2E\x68\x61\x73\x2D\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x29\x7B\x2E\x75\x73\x65\x72\x43\x6F\x6E\x74\x65\x6E\x74\x57\x72\x61\x70\x70\x65\x72\x7B\x2E\x66\x62\x55\x73\x65\x72\x43\x6F\x6E\x74\x65\x6E\x74\x7B\x31\x7B\x6C\x6F\x67\x7B\x61\x5B\x64\x61\x74\x61\x2D\x76\x69\x64\x65\x6F\x2D\x69\x64\x5D\x7B\x73\x64\x20\x68\x64\x7B\x2E\x6D\x74\x6D\x2E\x5F\x35\x70\x63\x6D\x3A\x6E\x6F\x74\x28\x2E\x68\x61\x73\x2D\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x29\x7B\x23\x70\x65\x72\x6D\x61\x6C\x69\x6E\x6B\x5F\x76\x69\x64\x65\x6F\x5F\x70\x61\x67\x65\x6C\x65\x74\x7B\x65\x78\x65\x63\x7B\x68\x61\x73\x43\x6C\x61\x73\x73\x7B\x3C\x64\x69\x76\x20\x63\x6C\x61\x73\x73\x3D\x27\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x27\x20\x73\x74\x79\x6C\x65\x3D\x27\x6D\x61\x72\x67\x69\x6E\x2D\x62\x6F\x74\x74\x6F\x6D\x3A\x20\x31\x30\x70\x78\x27\x3E\x7B\x20\x50\x6F\x77\x65\x72\x65\x64\x20\x62\x79\x20\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x7B\x3C\x64\x69\x76\x20\x63\x6C\x61\x73\x73\x3D\x27\x63\x6C\x65\x61\x72\x66\x69\x78\x27\x3E\x44\x6F\x77\x6E\x6C\x6F\x61\x64\x20\x74\x68\x69\x73\x20\x76\x69\x64\x65\x6F\x20\x61\x74\x20\x68\x65\x72\x65\x3A\x20\x7B\x3C\x61\x20\x74\x61\x72\x67\x65\x74\x3D\x27\x5F\x62\x6C\x61\x6E\x6B\x27\x20\x68\x72\x65\x66\x3D\x27\x68\x74\x74\x70\x73\x3A\x2F\x2F\x66\x62\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x65\x72\x2E\x69\x6E\x66\x6F\x2F\x76\x69\x64\x65\x6F\x73\x2F\x7B\x70\x61\x72\x65\x6E\x74"];
If want to see the actual content, follow below steps :
Go to Google Chrome Console.
Copy your content and paste it.
Then print the variable using console.log(_0x2a14);
Below is what I got on my console.

Get sound rhythm - javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
how to get rhythm using js or jquery
Following soundcloudes and this image :
what is this name ?
If I understand you right you are looking for a way to generate waveforms. Try this library http://p5js.org/reference/#/p5.FFT

Categories

Resources