how to solve radical expression using javascript [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
This is my radical expression:
var equation1 = "\\sqrt[4]{8}";
var equation2 = "\\sqrt[6]{x^2}";
How to get answer of this using javascript.

JavaScript's exponentiation function is Math.pow(base, exponent), so the 4th root of 8 is Math.pow(8, 1/4).
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FMath%2Fpow et al.
If you're asking how to parse those strings of yours and evaluate, that's a different thing altogether.

Related

Validate IP range and subnets [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to write a JavaScript function which accepts IP range or subnets and validate it.
Like 10.0.0.1/24 should return true
10.0.0.1-10.0.0.10 should return true.
Use:
((\b|\.)(1|2(?!5(?=6|7|8|9)|6|7|8|9))?\d{1,2}){4}(-((\b|\.)(1|2(?!5(?=6|7|8|9)|6|7|8|9))?\d{1,2}){4}|\/((1|2|3(?=1|2))\d|\d))\b
http://regex101.com/r/aJ6jK2
This one also allows leading zeros:
((\b|\.)(0|1|2(?!5(?=6|7|8|9)|6|7|8|9))?\d{1,2}){4}(-((\b|\.)(0|1|2(?!5(?=6|7|8|9)|6|7|8|9))?\d{1,2}){4}|\/((0|1|2|3(?=1|2))\d|\d))\b
http://regex101.com/r/tT8sC5

How can I avoid getting a message saying an object is not defined? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have code that does this:
$scope.grid.data = null;
However it could be the case that $scope.grid has not yet been defined. If that's the case then how could I avoid trying to do this assignment?
if($scope.grid){
$scope.grid.data = null;
}
Can find more elaborate response here: JavaScript object detection: dot syntax versus 'in' keyword

Javascript Regex replace string between 2 strings [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to figure out the best way to replace a string between 2 other strings. I believe regex is necessary for this.
Input string:
"http://domainabc.com/dir1/dir2"
Output string:
"http://domainxyz.com/dir1/dir2"
Only the domain will change - not the subdirectories.
Probably you're looking to change current domain name without bothering what the domain is. Try this code:
var s = "http://domainabc.com/dir1/dir2";
repl = s.replace(/\b(https?:\/\/)[^/]+(.+)$/, "$1domainxyz.com$2");
//=> http://domainxyz.com/dir1/dir2

Javascript zip code , six numberic digit excluding space [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have this original code. Can I know what is the meaning of this code? I confuse a bit.
if (/^\d{5}(-\d{4})?$/.test(zip.value)) {
I need to rewrite to zip code with 6 numeric digit excluding space. How should I do?
you can find your explanation here: http://rick.measham.id.au/paste/explain.pl?regex=%2F%5E%5Cd%7B5%7D%28-%5Cd%7B4%7D%29%3F%24%2F

Create a field to accept tags HTML/JS [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I wanna create something like this in my website.Help me out please.!image
Try this may be it's helpful for you..
http://sproutsocial.github.io/inputosaurus-text/

Categories