xxxxxxxxxx
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
con.query("CREATE DATABASE mydb", function (err, result) {
if (err) throw err;
console.log("Database created");
});
});
xxxxxxxxxx
var str = 'mystring';
// the character 'g' will be removed
str = str.slice(0, -1);
xxxxxxxxxx
const text = 'abcdef'
const editedText = text.slice(0, -1) //'abcde'
xxxxxxxxxx
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
xxxxxxxxxx
let str = "meguenniwalid";
//will remove d from str by using slice()
str = str.slice(0, -1);
//output
console.log(str);
//meguenniwali
xxxxxxxxxx
<script>
var any = 'mystring';
any = str.slice(0, -1);
//g will be remove from mystring to (mystrin).
//i hope you understand.
</script>
xxxxxxxxxx
var str = 'mystring';
// the character 'g' will be removed
str = str.slice(0, -1);
let str = "12345.00";
str = str.slice(0, -1);
console.log(str);
xxxxxxxxxx
var mysql = require('mysql')
var con = mysql.createConnection({
host: "localhost",
user: "yourusername",
password: "yourpassword"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
con.query("CREATE DATABASE mydb", function (err, result) {
if (err) throw err;
console.log("Database created");
});
});