<commit_before>/** 
Activity one (data types)
--------------------------
--------------------------
what data type?
14 ----------------------- Number
-80 ---------------------- Number
8.5 ---------------------- Number
true --------------------- Boolean
(5 < 7) ------------------ Boolean
null --------------------- Undefined
3.141 -------------------- Number
"Pi" --------------------- String
67+18 -------------------- Number 
**/


console.log("<NAME>");				//log my name to console

convertToBinary = function(x) {
	//Converts decimal to binary
	var result = [];						//Initialize result array
	while (x) {
		 var remainder = x % 2;				//get modulus of x
		 result.push(remainder);	 			//store the modulus in the result array
		 x = (x / 2) | 0;						//get the new value for x
	} 
	result.reverse();						// reverse the order of the array
	return result.join("");					// join the elements of the array and return the result as string
};

countBs = function(x) {
	if (typeof(x) === "string" ) {									//check for input type
		for (var i = 0, len = x.length, count = 0; i < len; i++) {	//initialize variables
			if (x.charAt(i) === "B") {								//check if the string contains 'B' character
				count++;											//increment count
			}
		}
		return count;
	} else {
		return "Input is not a string";
	}
};


countChar = function(x, y) {
	if (typeof(x) === "string" && x.indexOf(y) !== -1) {			//check that both inputs are string and y is in x
		for (var i = 0, max = x.length, count = 0; i < max; i++) {	//initialize variables
			if (x.charAt(i) === y) {									
				count++;											//increment count
			}
		}
		return count;
	} else {
		return "Inputs not permitted";
	}
};


countBs2 = function(x) {
	return countChar(x, "B");										//call the function "countChar" with string "B" as the second input
}
<commit_msg>did my corrections<commit_after>/** 
Activity one (data types)
--------------------------
--------------------------
what data type?
14 ----------------------- Number
-80 ---------------------- Number
8.5 ---------------------- Number
true --------------------- Boolean
(5 < 7) ------------------ Boolean
null --------------------- Undefined
3.141 -------------------- Number
"Pi" --------------------- String
67+18 -------------------- Number 
**/


console.log("<NAME>");				//log my name to console

var convertToBinary = function(decimal) {
	//Converts decimal to binary
	var result = [];						//Initialize result array
	
	while (decimal) {
		 var remainder = decimal % 2;				//get modulus of decimal
		 result.push(remainder);	 			//store the modulus in the result array
		 decimal = (decimal / 2) | 0;						//get the new value for decimal
	} 
	
	result.reverse();						// reverse the order of the array
	return result.join("");					// join the elements of the array and return the result as string
};


var countBs = function(word) {
	
	if (typeof(word) === "string" ) {									//check for input type
		
		for (var i = 0, len = word.length, count = 0; i < len; i++) {	//initialize variables
			
			if (word.charAt(i) === "B") {								//check if the string contains 'B' character
				count++;											//increment count
			}
		}
		return count;

	} else {
		return "Input is not a string";
	}
};


var countChar = function(word, character) {
	if (typeof(word) === "string" && word.indexOf(character) !== -1) {	//check that both inputs are string and character is in word

		for (var i = 0, max = word.length, count = 0; i < max; i++) {	//initialize variables
			
			if (word.charAt(i) === character) {									
				count++;											//increment count
			}

		}
		return count;

	} else {
		return "Inputs not permitted";
	}
};


var countBs2 = function(word) {
	return countChar(word, "B");										//call the function "countChar" with string "B" as the second input
}
{'fraction_non_alphanumeric': 0.2464529689963216, 'fraction_numerical': 0.013137151865475564, 'mean_word_length': 1.6474269819193323, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '624236', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1110, 'n_words': 402}