sorta like jquery but I wanna make a function in js with a .whatever at the end, for example function().text() or something like that what I've tried to do is 
function a() {
    function click() {
        alert("hi");
    }
}
sorta like jquery but I wanna make a function in js with a .whatever at the end, for example function().text() or something like that what I've tried to do is 
function a() {
    function click() {
        alert("hi");
    }
}
 
    
    "function" is a reserved word so you can't use that as a function name. You could create a function with a different name such as "foo". It needs to return an object with the key "whatever" which is another function that you can call and do something with.
For example:
function foobar (){
 const foo = {}
    foo.whatever = function (){
     console.log('foobar')
    }
    return foo
}
foobar().whatever()