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
likeBar is an object and dislikeBar too,how to parse '107px' into number,i used parseFloat and others ,but i couldn't
likeBar: {
width: '107px'
},
dislikeBar: {
width: '107px'
}
Number(String(likebar.width).replace('px',''));
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 2 years ago.
Improve this question
I have this declared in my class:
somePair: KVPair;
Where KVPair is just a key value pair JSON.
Then in my displayFN I set it like so:
displayFn(pair: KVPair) {
this.somePair = pair;
}
But when I console.log(somePair) outside of displayFn, it's undefined, and I'm not sure why.
I was trying to set it with a [displayWith] which was clearing somePair.
When I set it in (optionSelected)="someFunction($event.option.value)", the value stuck around.
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
I have a string
var str="[a54hy 8:45pm],[f57gh 9:20]"
i need to get
[f57gh 9:20pm]
I don't want to use split since the string length can be anything
This worked for me. where id is f57gh
var re='\\['+id + '([a-z0-9: ]+)\\]';
var rematch=RegExp(re,'g');
var mydata=str.match(rematch);
alert(mydata); //[f57gh 9:11am]
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 7 years ago.
Improve this question
I have d1 and d2 set in hour:minute:seconds format... How can I compare two time variables and if first is greater execute the function.
In short.
if(d1>d2)
{
//run function
}
Look this
Date.parse('01/01/2011 10:20:45') > Date.parse('01/01/2011 5:10:10')
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
so i have this array:["bilder/test/_PRF6367.JPG.jpg", "bilder/test/_PRF6372.JPG.jpg", "bilder/test/_PRF6374.JPG.jpg"]
how do i split the individial strings JUST into _PRF6367.JPG.jpg etc.
Use Array.prototype.map to create new array of modified strings:
["bilder/test/_PRF6367.JPG.jpg", "bilder/test/_PRF6372.JPG.jpg", "bilder/test/_PRF6374.JPG.jpg"].map(function(str) {
return str.split('/').pop();
});
Result:
["_PRF6367.JPG.jpg", "_PRF6372.JPG.jpg", "_PRF6374.JPG.jpg"]
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
how would I check for string
<something> in var string = "some chars <something> somechars"
You can use String.match():
var res = string.match(/<something>/g); // ["<something>"]
If there is no match, the value of res will be null. See example on JSFiddle.