How to improve the Algorithm Development Process?

How do we improve our problem solving?

// Write a function toggleCase which takes in a string and returns a new string where all the lowercase 
// letters are changed to uppercase and all the uppercase letters are changed to lowercase
toggleCase('ZaCh'); //'zAcH'
toggleCase('APPLE'); //'apple'
toggleCase('Good morning, everyone!'); //'gOOD MORNING, EVERYONE!'
// Using array conversion method function toggleCase(string) {
var splitString = string.split(""); // array
var result = [];
for (var i = 0; i < splitString.length; i ++) {
if (splitString[i] === splitString[i].toLowerCase()) {
splitString[i] = splitString[i].toUpperCase()
} else {
splitString[i] = splitString[i].toLowerCase()
return result.join("");
// Using string concatenation methodfunction toggleCase(string) {
var newString = "";
for (var i = 0; i < string.length; i ++) {
if (string[i] === string[i].toLowerCase()) {
newString += string[i].toUpperCase();
} else {
newString += string[i].toLowerCase();
return newString;

Software Engineering Student at Flatiron School

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store