Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I'm trying to find a way to output an array in alphabetical order as well as the length by a window alert, or alternatively any way for the user to be able to see it, when they're in the browser.
Here is the little bit of code:-
var vehicles = ["Car", "Bus", "Train", "Boat","Plane"];
vehicles.sort();
As well as:-
vehicles.length();
It is vehicles.length not vehicles.length()
You can output in an alert
alert( vehicles.length );
or log into the console
console.log( vehicles.length );
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 days ago.
Improve this question
I am trying to convert sSlack mention markup to custom string so I can use it for better presentation.
Example input: #[user a name ](12345) (hi) #[user b name](67890)
Required output: <#12345> (hi) <#67890>
I have tried input.replaceAll(/#\[(.*?)\]\(.*?\)/g, "<#$1>"), but this prints the user name and not ID.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
Below is the code I currently using which I need to round the end result to 2 decimals.Can someone help me figure out what I did wrong.
total = panjang*ht+hf;
document.getElementById("ototal").innerHTML =eval(total(toFixed(2)));
The variable total is a number, not a function.
You should use toFixed function like this
total.toFixed(2)
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am trying a very basic javascript map example
var map1 = {'myKey1':11, 'mykey2':22};
var t = map1['mykey1'];
alert(t);
But the alert always gives me 'undefined', it should give me '11'
please guide what i am doing wrong
You have a spelling mistake there mate, notice that in your map1 object there is no mykey1 key actually, there is a myKey1 key however, containing a capital K
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
i am trying to check what items are in array.
this is my code
var fruits=['banana','orange','lemon'];
fruits.splice(0,1,'apple');
for (i=0;i<=fruit.length;i++)
{
alert('The fruits are' + fruits[i]);
};
Somehow it's not Working.
please tell me where i am doing wrong.
thanks.
Have you mistakenly added fruit.length or you have written code like this?
syntax;-
array.splice(index,howmany,item1,.....,itemX)
index->positon from/to u want to ad and remove items
howmany->how many item u want add/remove
item->item list(for more than pne seprate it by comma)
also:-
please add s after fruit in for loop
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I can not figure out why I can't access the result elements.
Whats getting returned:
[{"customSurfaceMaster": {"CSMasterID":1,"CSName":"Q17","QuestionId":12,"OpType":"22","OpFlag":null,"ChartType":"Bar"},"UserCSID":1,"UserId":2,"CSMasterID":1,"PeriodType":null,"PeriodStartValue":null,"PeriodEndValue":null,"ImpLevel":1,"DisplayOrder":1,"Visible":true}]
Trying to access here:
var Tile = BindTiles(result.customSurfaceMaster.chartType, result.customSurfaceMaster.CSname, result.ImpLevel);
The error:
result.customSurfaceMaster is undefined
Try this:
var Tile = BindTiles(result.customSurfaceMaster[0].chartType, result.customSurfaceMaster[0].CSname, result.ImpLevel);