Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
How can I change the value of a constant variable? For example, I have the price on my site:
const PHONE_PRICE = 250;
but now I want to change it in this assignment without making changes elsewhere. Is it possible?
No. The purpose of a constant is precisely that it can't change. If you want it to change, make it a variable:
let PHONE_PRICE = 250;
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 months ago.
Improve this question
Im not sure if my question is right but I want to convert this array
["url1","url2","url3","url4","url5","url6"]
I want it to become like this
["url1"],
["url2"],
["url3"],
["url4"],
["url5"],
["url6"],
How can I achieve this on javascript?
Thanks
you can map your array to return a new one for each element
const data = ["url1","url2","url3","url4","url5","url6"];
console.log(data.map(one => [one]));
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How do you increment a currency fractional part?
For instance, let's say you have 14.0009 and you want to increment it to 14.0010 when press the up arrow key
If you are using a HTML5 Input number field then set the step attribute to step="0.0001".
See more: https://www.w3schools.com/tags/att_input_step.asp
See more: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/step
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
How to target an html attribute with JS by his id and make it equal to some number.
document.getElementById('foo').setAttribute('bar', 0);
Where foo is the ID of your element and bar is the name of the attribute you want to change.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i want to change certain elements regarding their style by detecting the initial scale already used by the owner of the website.
Thanks
I found it my self,
var scale=Number((screen.width/window.innerWidth).toFixed(1));
scale has the required value!
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am new to Javascript, I want my variable to be printed on the webpage, but not using <span> and innerHTML
var pProductCode = $('[name=pProductCode]').val();
$('input[id*="_IP/PA_N_"]').each(function(i){
ipPAAmt += Number(convertToNumber($(this).val()));
});
How can I do that?
There are more detailed answers that apply to your situation at:
How to display javascript variables in a html page without document.write
Basically you want to create an html element and then replace the contents with your variable.
$('#yourDivID').html(ipPAAmt);