Javascript has Array.join()
js>["Bill","Bob","Steve"].join(" and ")
Bill and Bob and Steve
Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Javascript has Array.join()
js>["Bill","Bob","Steve"].join(" and ")
Bill and Bob and Steve
Usually, during software development, there are all sorts of utility functions I need. Like zipped file, extract zip file, launching Web Browser, get scaled image...
My complete code:
jQuery.extend({
combinationCheck: function (p1position) {
var Combination = [1, 2, 3, 4, 5, 6, 7, 8];
Combination[0] = [1, 2, 3];
Combination[1] = [4, 5, 6];
Combination[2] = [7, 8, 9];
Combination[3] = [1, 4, 7];
Combination[4] = [2, 5, 8];
Combination[5] = [4, 6, 8];
Combination[6] = [1, 5, 9];
Combination[7] = [3, 5, 7];
$.each(p1position, function (index, value) {
var num = value;
if ($.inArray(String(value), Combination[1]) != '-1') {
alert("there");
}
else {
alert("not there");
}
});
});
My complete code:
jQuery.extend({
combinationCheck: function (p1position) {
var Combination = [1, 2, 3, 4, 5, 6, 7, 8];
Combination[0] = [1, 2, 3];
Combination[1] = [4, 5, 6];
Combination[2] = [7, 8, 9];
Combination[3] = [1, 4, 7];
Combination[4] = [2, 5, 8];
Combination[5] = [4, 6, 8];
Combination[6] = [1, 5, 9];
Combination[7] = [3, 5, 7];
$.each(p1position, function (index, value) {
var num = value;
if ($.inArray(String(value), Combination[1]) != '-1') {
alert("there");
}
else {
alert("not there");
}
});
});